3、i;}for(i=0;i<10;i++)printf("max=%d,postion=%d",max,pos+1);}5.判断是不是水仙花数#includemain(){intt,a,b,c;scanf("%d",&t);a=(t-t%100)/100;c=(t%100)%10;b=(t%100-c)/10;if(t==a*a*a+b*b*b+c*c*c)printf("%d",t);elseprintf("无效");}6.在3到1000的全部润年#includemain(){intyear;for(year=3;year<=
4、1000;year++){if(!(year%4==0&&year%100!=0
5、
6、year%400==0))continue;printf(“%4d”,year);}}7.求1+2+3+4…+100之和#includemain(){inti,s;s=0;for(i=1;i<=100;i++)s=i+s;printf("s=%d",s);}或者#includemain(){inti,s;s=0;i=1;do{s=s+i;i++;}while(i<=100);printf("s=%d,i=%d",s,i);}6.求n!#in
7、cludemain(){intn,i,p=1;intn,i;scanf(“%d”,&n);for(i=1;i<=n;i++)p=p*i;printf(“%ld”,p);}8.输入三个实数a,b,c要求从小到大的顺序输出#includemain(){floata,b,c,t;scanf("%f,%f,%f",&a,&b,&c);if(a>b){t=a;a=b;b=t;}if(a>c){t=a;a=c;b=t;}if(b>c){t=b;b=c;c=t;}printf("%5.2f,%5.2f,%5.2f",a,b,c);}
8、9.判断年份是不是润年?#includemain(){intyear;printf("请输入年份");scanf("%d",&year);{if(year%4==0&&year%100!=0
9、
10、year%400==0)printf("%4d是闰年",year);elseprintf("%4d不是润年",year);}}10.寻找1-999中的水仙花数#includemain(){inti,j,k;for(i=1;i<10;i++)for(j=0;j<10;j++)for(k=0;k<10;k++)if(i*100+j*10+k
11、==i*i*i+j*j*j+k*k*k)printf("%dt",(i*100+j*10+k));}11.比较大小#includemain(){inta,b,c,max;scanf("%d%d%d",&a,&b,&c);if(a>b)if(a>c)max=a;elsemax=c;elseif(b>c)max=b;elsemax=c;printf("max=%d",max);}12.任意输入一行大写字母,将它们转换成小写字母后输出。#includemain(){inti;charc;for(i=1;(c=getchar()
12、)!='';i++)