1、
#include<stdio.h>
int main(void)
{
int count,sum,max;
count=0;
sum=0;
printf("Please input the max:");
scanf("%d",&max);
while(count++<max)
sum=sum+count;
printf("sum=%d\n",sum);
return 0;
}
2、
#include<stdio.h>
#define MAX 100
int main(void)
{
int count=MAX+1;
while(--count>0)
{
printf("%d bottles of spring water on the wall,"
"%d bottles of spring water!\n",count,count);
printf("Take one down and pass it around,\n");
printf("%d bottles of spring water!\n\n",count-1);
}
return 0;
}