#include
void main()
{int i=1,s=0;
while(i>100)
{
s+=i;
i++;
}
printf("%d",s);
}
//用while语句计算 s=1+2+3+……+99+100.
#include
void main()
{
int i=0,n=0;
while (i++<100)
n+=i;
printf("%d\n",n);
}
#include
void main()
{
int i=1,sum=0;
while(i<=100)
{
sum+=i;
}
printf("sum = %d",sum);
getch();
}
#include
void main()
{
int i=0,sum=0;
while(i++<100)
{
sum+=i;
}
printf("sum = %d\n",sum);
}
#include
int main()
{
int i=1,sum=0;
while(i<=100)
{
sum+=i++;
}
printf("sum is %d\n",sum);
return 0;
}