#include "stdio.h"
main()
{
int x=2,sum=0;
do
{
sum+=x;
x=x+2;
}
while(x<102);
{
}
printf("The sum of them is %d",sum);
}
使用do while循环,计算2+4+6+...+100
最新推荐文章于 2023-09-18 09:43:17 发布
#include "stdio.h"
main()
{
int x=2,sum=0;
do
{
sum+=x;
x=x+2;
}
while(x<102);
{
}
printf("The sum of them is %d",sum);
}