#ibclude<stdio.h>
int main()
{
int a,x,max;
printf("Input x:");
scanf("%d",&x);
max=0;
a=1;
do{
max=max+a;
a++;
}while(a<=x);
printf("max=%d\n",max);
return 0;
}
运行结果:
学到了什么:会使用do while语句,知道它是先循环在执行。