资源描述:
《云南大学__软件学院__c语言____所有实验代码》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、第二次试验///第三次试验=====================程序============================#includeintmain(){/*十进制*/printf("%d",3+4*6);printf("%d",3*4/6+6);printf("%d",2*3/12*8/4);printf("%d",10*(1+7*3));printf("%d",20-2/6+3);printf("%d",20-2/(6+3));printf("%d",(20-2)/6+3);prin
2、tf("%d",(20-2)/(6+3));/*9-16显示为小数,保留小数2位,宽度为8*/printf("%8.2f",3.0+4.0*6.0);printf("%8.2f",3.0*4.0/6.0+6.0);printf("%8.2f",2.0*3.0/12.0*8.0/4.0);printf("%8.2f",10.0*(1.0+7.0*3.0));printf("%8.2f",20.0-2.0/6.0+3.0);printf("%8.2f",20.0-2.0/(6.0+3.0));printf("%8.2f
3、",(20.0-2.0)/6.0+3.0);printf("%8.2f",(20.0-2.0)/(6.0+3.0));/*17-20显示为字符*/printf("%c",'m'-5);printf("%c",'m'+5);printf("%c",'G'+6);printf("%c",'G'-6);/*21-23显示为十进制整数*/printf("%d",'b'-'a');printf("%d",'g'-'a'+1);printf("%d",'g'-'a'+1);}======================
4、=运行结果=====================================================================程序==========================#includeintmain(){floatCel,Fah;printf("printaFahnumber:");scanf("%f",&Fah);Cel=5.0/9.0*(Fah-32);printf("TheCelnumberis%f",Cel);printf("printaCelnumber:");scanf("
5、%f",&Cel);Fah=32+9.0*Cel/5.0;printf("TheFahnumberis:%f",Fah);return0;}============================运行结果=========================第四次试验************************************(1)程序**********************************#includeintmain(){intnum1,num2,num3,max,min;printf("plea
6、seinputthreenumbers:");scanf("%d%d%d",&num1,&num2,&num3);max=(num1>num2)?num1:num2;min=(num1<=num2)?num1:num2;max=(num3>max)?num3:max;min=(num37、***************************************(2)程序*********************************#includeintmain(){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+
8、10000;break;case2:case3:income=(profit-200000)*0.05+10000+7500;break;case4:case5:i