现有如下程序段:
#include"stdio.h"
main()
{int k[30]={12,324,45,6,768,98,21,34,453,456};
int count=0,i=0;
while(k[i])
{if(k[i]%2==0||k[i]%5==0)
count++;
i++;}
printf("%d,%d\n",count,i);
}
则程序段的输出结果为
count为这个数组内2或者5的倍数的数 的个数,你这样看应该就能理解了。
所以只有21和453不满足,count就是8个,i=10,