回复 楼主 C小菜
#include <stdio.h>#include <stdlib.h>
int main()
{
int odd_num = 0;
int even_num = 0;
int i = 0;
for(i = 0;i <= 1000;i++)
if( i%2 == 0 )
{
even_num = even_num + i;
}else{
odd_num = odd_num + i;
}
printf("even_num = %d\n",even_num);
printf("odd_num = %d\n",odd_num);
system("pause");
return 0;
}