#include stdio.hint main( void ){static int count = 0;for (int x = 0; x 101; x++){if (x % 2 == 0)/*if x is even...*/
编程学习网为您整理以下代码实例,主要实现:找出0到100之间的偶数。,希望可以帮到各位朋友。
#include <stdio.h>
int main( voID )
{
static int count = 0;
for (int x = 0; x < 101; x++)
{
if (x % 2 == 0) /*if x is even...*/
count++; /*add 1 to count.*/
}
printf("There are %d even numbers.\n", count);
return 0;
}