i 6
CÂU LNH IU KHIN
1.Câu lnh while
p (Syntax):
( expression )
// thân lp

int count = 0;
while( count < 10)
cout << ++count << endl;

int main()
{ int x, count = 0;
= 0.0 ;
<< " Nhp mt vi snguyên: \n"
Nhp ktbt k !"t"
<< endl;
while (cin >> x )
#sum += x ;
$$count;
%
cout << "&"'(trung b)nh : " << sum/count << end;
return 0 ; }
2.Câu lnh for
*+,"p

int i, count = 0;
'(i=1; i <10; ++i)
<< ++count;
Bi!u th-c (expression) c.th!.nhi/u ph0n
"ch nhau b1i du ph2y v 34c "nh gi"t5
'"i sang,
for ( expression1; expression2; expression3 )
statement

int x, i, limit ;
for (i=0, limit=8; i<limit; i +=2)
6= i*i , cout << setw(10) << x;
78ng du ph2y trong p"t bi!u (statement)

6= (a=3,b=5, a*b) 9"'(:a a*b 34c g"n
cho x