发布网友 发布时间:2022-04-27 12:31
共1个回答
热心网友 时间:2023-09-19 20:48
1、求1+2+3+……….+100。(循环)答案#includevoidmain(){inti,sum=0;for(i=1;ivoidmain(){inta,b,c,d;scanf("%d,%d,%d",&a,&b,&c);d=max(a,b,c);printf("max=%d",d);getch();/*暂停看运行结果*/}intmax(intx,inty,intz){intu;if(x>=y&&x>=z)u=x;elseif(y>=x&&y>=z)u=y;elseu=z;return(u);4.用起泡法对十个数据排序(数组实现)答案#includemain(){inti,j,t;staticinta[10]={5,7,4,2,3,6,1,0,9,8};for(j=0;ja[i+1]){t=a[i];a[i]=a[i+1];a[i+1]=t;}}}for(i=0;imain(){inta[10],i=0;for(i=0;i=0;i--)printf("%f",a[i]);}6输入两个数,交换他们的值并输出。(元素交换)答案#includeintmain(){intm,n,temp;scanf("%d%d",&m,&n);if(mvoidmain(){inti=1;for(i;i='a')a[i]=a[i]-32;printf("%c",a[i]);}printf("\n小写为:");for(i=0;i=65&&c=97&&c=48&&c=100&&xvoidmain(){charc;while((c=getchar())!='\n'){c=c+4;if(c>'Z'+4||c>'z')c=c-26;}printf("%c",c);}printf("\n");}12,P1115.55.6(switch)5.5#includemain(){intx,y;printf("输入x:");scanf("%d",&x);if(xmain(){floatscore;chargrade;case2:printf("请输入学生成绩:");scanf("%f",&score);while(score>100||(scorevoidmain(){intyear,leap;scanf("%d",&year);if(year%4==0){if(year%100==0){if(year%400==0)leap=1;elseleap=0;}elseleap=1;}elseleap=0;if(leap)printf("%dis",year);elseprintf("%disnot",year);printf("aleapyear.\n")}5.614,P31例2.17例2.182.17输出50个学生中成绩高于80分者的学号和成绩2.18输出2000——2500年每一年是否闰年#includevoidmain(){intyear;year=2000;go:if(((year%4==0)&&(year%100!=0))||(year%400==0))printf("%disrunnian",year);if(year2500)gotoend;gotogo;end:getch();}希望对你有所帮助追问这是什么?