2、io.h>intmain(void){intaverage,math,eng,comp;math=87;eng=72;comp=93;average=(math+eng+comp)/3;printf("math=%d,eng=%d,comp=%d,average=%d",math,eng,comp,average);return0;}(4)#includeintmain(void){intn,a,b,c;n=152;c=n%10;b=(n/10)%10;a=n/100;printf("整数%d的个位数字是%d,十位数字是%d,百位数字是%d",
3、n,c,b,a);return0;}P27(1)#include#includeintmain(void){intcelsius,fahr;printf("Entercelsius:");scanf("%d",&celsius);fahr=9*celsius/5+32;printf("fahr%d",fahr);return0;}(2)#include#includeintmain(void){intmoney,year;doublerate,interest;printf("Entermoney,
4、year,rate:");scanf("%d%d%lf",&money,&year,&rate);interest=money*pow(1+rate,year)-money;printf("interest=%.2f",interest);return0;}(3)#include#includeintmain(void){doublex,y;printf("Enterx:");scanf("%lf",&x);if(x<0){y=pow(x+1,2)+2*x+1/x;}else{y=sqrt(x);}printf("y=f(%f)=%
5、.2f",x,y);return0;}(4)#includeintmain(void){intx,y;printf("Enternum1:");scanf("%d",&x);printf("Enternum2:");scanf("%d",&y);printf("%d+%d=%d",x,y,x+y);printf("%d-%d=%d",x,y,x-y);printf("%d*%d=%d",x,y,x*y);printf("%d/%d=%d",x,y,x/y);printf("%d%%%d=%d",x,y,x%y);return0;
6、}10的阶乘#includeintmain(void){inti,n,product;printf("Entern:");scanf("%d",&n);product=1;for(i=1;i<=n;i++){product=product*i;}printf("product=%d",product);return0;}