2025-03-06 23:47:59 +08:00

21 lines
416 B
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*-------------------------------------------------------
题目请将123-321之间偶数累加输出最终结果。
--------------------------------------------------------*/
#include <stdio.h>
int main()
{
int i;
long sum = 0;
for(i = 123; i <= 321; i++ )
{
/**********Program**********/
if(i%2==0){
sum += i;
}
/********** End **********/
}
printf ("总和为 : %ld.\n",sum);
return 0;
}