.-第二次试验///第三次试验=====================程序============================#includestdio.hintmain(){/*十进制*/printf(%d\n,3+4*6);printf(%d\n,3*4/6+6);printf(%d\n,2*3/12*8/4);printf(%d\n,10*(1+7*3));printf(%d\n,20-2/6+3);printf(%d\n,20-2/(6+3));printf(%d\n,(20-2)/6+3);printf(%d\n,(20-2)/(6+3));/*9-16显示为小数,保留小数2位,宽度为8*/printf(%8.2f\n,3.0+4.0*6.0);printf(%8.2f\n,3.0*4.0/6.0+6.0);printf(%8.2f\n,2.0*3.0/12.0*8.0/4.0);printf(%8.2f\n,10.0*(1.0+7.0*3.0));printf(%8.2f\n,20.0-2.0/6.0+3.0);printf(%8.2f\n,20.0-2.0/(6.0+3.0));printf(%8.2f\n,(20.0-2.0)/6.0+3.0);printf(%8.2f\n,(20.0-2.0)/(6.0+3.0));/*17-20显示为字符*/printf(%c\n,'m'-5);printf(%c\n,'m'+5);printf(%c\n,'G'+6);printf(%c\n,'G'-6);/*21-23显示为十进制整数*/printf(%d\n,'b'-'a');printf(%d\n,'g'-'a'+1);printf(%d\n,'g'-'a'+1);}=======================运行结果====================================.-=================================程序==========================#includestdio.hintmain(){floatCel,Fah;printf(printaFahnumber:);scanf(%f,&Fah);Cel=5.0/9.0*(Fah-32);printf(TheCelnumberis%f\n,Cel);printf(printaCelnumber:);scanf(%f,&Cel);Fah=32+9.0*Cel/5.0;printf(TheFahnumberis:%f\n,Fah);return0;}============================运行结果=========================第四次试验************************************(1)程序**********************************#includestdio.hintmain(){intnum1,num2,num3,max,min;printf(pleaseinputthreenumbers:\n);scanf(%d%d%d,&num1,&num2,&num3);max=(num1num2)?num1:num2;min=(num1=num2)?num1:num2;max=(num3max)?num3:max;min=(num3min)?num3:min;printf(max=%dmin=%d,max,min);return0;}**************************************运行结果*********************************.-**************************************(2)程序*********************************#includestdio.hintmain(){inta;floatprofit,income;printf(Pleaseinputtheprofit:);scanf(%f,&profit);a=(profit-1)/100000;switch(a){case0:income=profit/10;break;case1:income=(profit-100000)*0.075+10000;break;case2:case3:income=(profit-200000)*0.05+10000+7500;break;case4:case5:income=(profit-400000)*0.03+10000+7500+10000;break;case6:case7:case8:case9:income=(profit-600000)*0.01+10000+7500+10000+6000;break;case10:income=(profit-1000000)*0.01+10000+7500+10000+6000+6000;}printf(奖金数值为:%f\n,income);return0;}.-************************************运行结果******************************************************************(3)程序****************************/*百马百担问题*/#includestdio.hintmain(){intA,B,C;printf(百马百担的解为:\n);printf(大中小\n);for(A=0;A=33;A++){for(B=0;B=50;B++){C=100-A-B;if(3*A+2*B+C/2.0==100)printf(%-2d%-2d%-2d\n,A,B,C);}}return0;}********************************运行结果*************************************************************(4)程序****************************************************************(5)程序**********************************//关于菱形的第一种算法//#includestdio.hintmain().-{inti,j,k;printf(请输入最长行的数字,为奇数k:);scanf(%d,&k);for(i=1;i=k;i++){for(j=1;j=k;j++){if((j+i)=(k+1)/2+1&&(i+j)=(k+1)*3/2-1&&i-j=(k+3)/2-2&&j-i=(k+3)/2-2)printf(*);elseprintf();}printf(\n);}return0;}//第二种算法///#includestdio.hintmain(){intK,X,C,N;printf(num=);scanf(%d,&N);for(C=1;C=(N+1)/2;C++){for(K=1;K=(N+1)/2-C;K++)printf();for(X=1;X=2*C-1;X++)printf(*);printf(\n);}for(C=(N+3)/2;C=N;C++){for(K=1;K=C-(N+1)/2;K++)printf();for(X=1;X=2*N+1-2*C;X++)printf(*);printf(\n);}}************************运行结果***************************************.-第5/6次试验*********************************(1)程序***********************************第7次试验**********************************(1)程序**********************************#includestdio.hintmain(){inti,j,n;printf(inputanumber);scanf(%d,&n);inta[n][n];printf(\n);for(i=0;in;i++){a[i][0]=1;a[i][i]=1;}for(i=2;in;i++)for(j=1;ji;j++)a[i][j]=a[i-1][j-1]+a[i-1][j];for(i=0;in;i++){for(j=0;j=i;j++)printf(%5d,a[i][j]);printf(\n);}}*********************************************运行结果**************************.-*******************************************(2)程序****************************方法一:#includestdio.hintmain(){inti;intfb[12]={1,1};for(i=2;i12;i++){fb[i]=fb[i-1]+fb[i-2];printf(第%d个月共有兔子%d只\n,i+1,fb[i]*2);}return0;}*****************************运行结果*********************************************************************************方法二:#includestdio.hintmain(){longf1,f2;inti;f1=f2=1;.-for(i=1;i=20;i++){printf(%12ld%12ld,f1,f2);if(i%2==0)printf(\n);f1=f1+f2;f2=f1+f2;}return0;}************************************运行结果******************************************************************(3)程序****************************************#includestdio.h#definenum10intnum1(int[],int);intnum2(int[],int);intmain(){voidsort1(intnum1[],intn);voidsort2(intnum2[],intn);inta[num],c[num],i,moves,j;printf(enterarrayhere:\n);for(i=0;i10;i++){j=i;scanf(%d,&a[i]);c[j]=a[i];}printf(thesortedarray:\n);sort1(a,num);printf(thesortedarray:\n);sort2(c,num);.-return0;}voidsort1(intnum1[],intn){inti,j,temp,b;for(i=0;in-1;i++){for(j=1;jn;j++){if(num1[j]num1[j-1]){temp=num1[j];num1[j]=num1[j-1];num1[j-1]=temp;}}for(b=0;bn;b++)printf(%5d,num1[b]);printf(\n);}}voidsort2(intnum2[],intn){inti,j,min,minidx,temp,b;for(i=0;in-1;i++){