while语句:
#include
int i=0,sum=0;
main()
{
while(i<=100)
{
sum+=i;
i++;
}
printf("%d",sum);
}
do...while语句:
#include
main(){
int i=0,sum=0;
do
{
sum+=i;
i++;
}while(i<=100);
printf("%d",sum);
}
for循环:
#include
main()
{
int i,sum=0;
for(i=0;i<=100;i++)
{
sum+=i;
}
printf("%d",sum);
}