Generated by Foxit PDF Creator © Foxit Software httpy/www.foxitsoftware.com For evaluation only Trường Đại học Khoa học Tự nhiên
Khoa Công nghệ thông tin
Bộ môn Tin học cơ sở
NHẬP MƠN LẬP TRÌNH Đặng Bình Phương
dbphuong@fit.hcmus.edu.vn
Trang 4Generated by Foxit PDF Creator © Foxit Software http://www.foxitsoftware.com For evaluation only
| @ Câu lệnh if (thiếu)
-void main () |
Thuvientailieu.net.vn
Trang 8com For evaluation only
Generated by Foxit PDF Creator © Foxit Software http:/Avww.foxitsoftware Nv’ t số lưu ý h if - Mộ ện au 7 so & B Ke
h if có thể lồng vào nhau và else sẽ
Trang 10.ˆ ' ' tu “hy Seeeneeeeees
Trang 11Generated by Foxit PDF Creator © Foxit Software httpy/www.foxitsoftware.com For evaluation only
Trang 12xn#n SSHRC CSS H ESR SESH Eee ESSERE eee
Trang 13by Foxit PDF Creator © Foxit Software Generated
httpy/www.foxitsoftware.com For evaluation only
Trang 15Generated by Foxit PDF Creator © Foxit Software httpy/www.foxitsoftware.com For evaluation only
Ke Câu lệnh switch - Một số lưu ý 5» Câu lệnh switch là một câu lệnh đơn và có thể lồng nhau |+ switch (a)
{ case 1 : printf (“Mot”); break;
_ case 3: printf£("Ba”); break;
default : printf(“Khong biet doc”) ;
Trang 16
Generated by Foxit PDF Creator © Foxit Software
Trang 17Generated by Foxit PDF Creator © Foxit Software TH khiiivee son For evaluation only
Câu lệnh switch - Một số lưu ý
3 switch sẽ nhảy đến case tương ứng và thực
Trang 18
s* switch nhảy đến case tương ứng và thực hiện
đến khi nào gặp break hoặc cuối switch sẽ kết
thúc
Thuvientailieu.net.vn
Trang 20&
Generated by Foxit PDF Creator © Foxit Software
Trang 22Generated by Foxit PDF Creator © Foxit Software
Tin Tưng sơn For evaluation only
Câu lệnh điều kiện và rẽ nhánh
Thuvientailieu.net.vn
Trang 23Generated ftp evr SSetsltare.com" Por eveluon ony POF Creator' Software
Trang 24Generated by Foxit PDF Creator © Foxit Software
fevers er ff For evaluation only
Thuvientailieu-net.vn
Trang 28Generated by Foxit PDF Creator © Foxit Software
http:/Awww.foxitsoftware.com For evaluation only #include <stdio.h> #include <conio.h> void main() { ivit':.a, b; printf (“Nhap a, b: ”); scanf (“%d%d”, &a, &b); if (a == 0) if (b == 0) printf (“Phuong trinh VSN”) ; else printf (“Phuong trinh VN”) ; else
printf (“Nghiem = %f”, float (-b) /a)izs ee
Câu lệnh điều kiện và rẽ nhánh ` ee
Thuvientailieu-net.vn
Trang 29#include <stdio.h> void main() { int .a, b, cy
print£ (“Nhap: a, b; oe: ”) 7
Trang 30
#include <stdio.h> |
void main () |
—_nnnne=
(V422 2t ty xe t = BESS eee e setae eeeeeee
SHCEC SSS SELES SSeS pane Ee