73课-求1到100的所有奇数的个数

 1 #include <stdio.h>
 2 
 3 int main (void)
 4 {
 5     int i;
 6     int cnt = 0;//个数一般是用cnt表示,count的缩写!
 7     
 8     for  (i = 1;i<5; ++i)
 9     {
10         if (i%2 == 1)
11                 ++cnt;
12     }
13     printf ("cnt = %d\n", cnt);
14     
15     return 0;
16 }

猜你喜欢

转载自www.cnblogs.com/a188/p/12373955.html