https://www.cnblogs.com/longhai3/longhai

C语言>>for循环

Posted on 2022-02-12 19:32  凡是过去,皆为序曲  阅读(91)  评论(0编辑  收藏  举报

for1到100和

 

#include<stdio.h>
int main()
{
int a,b=0;
for(a=1;a<=100;a++)
{b=b+a;}
printf("%d",b);
return 0;
}

 

===================================================================

for200以内奇数

#include<stdio.h>
int main()
{
int a;
for(a=0;a<=200;a++)
{
if(a%2!=0)
{
printf("%5d",a);
}
}
return 0;
}

随心,随记

https://www.cnblogs.com/w1hg/331817