资源描述:
《c语言上级报告答案》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、实验一1、#includevoidmain(){inta,b,c;scanf("%d,%d,%d",&a,&b,&c);printf("sum=%d",a+b+c);}2、#includevoidmain(){inta,b,he,cha,ji,shang;scanf("%d,%d",&a,&b);he=a+b;cha=a-b;ji=a*b;shang=a/b;printf("he=%d",he);printf("cha=%d",cha);printf("ji=%d",ji);printf("shang=%d",sh
2、ang);}3、#includevoidmain(){inta,b,c,d,e,sum;scanf("%d,%d,%d,%d,%d",&a,&b,&c,&d,&e);sum=a*a+b*b+c*c+d*d+e*e;printf("sum=%d",sum);}4#includeincludevoidmain(){doublea,b,c,sum;scanf("%lf,%lf,%lf",&a,&b,&c);sum=sqrt(a)+sqrt(b)+sqrt(c);printf("sum=%f",sum);}5、#inc
3、lude#definePI3.14159voidmain(){floatr,l,s;printf("请输入圆半径(r):");scanf("%f",&r);l=2*PI*r;s=r*r*PI;printf("圆周长l=%6.2f",l);printf("圆面积s=%6.2f",s);}6、#includevoidmain(){printf(""whatabeautifulcampus!"");printf(""Iwishyoueverysuccess!"");}实验二1、#includev
4、oidmain(){inta,b,c;floatx;scanf("a=%d,b=%d,c=%d,x=%f",&a,&b,&c,&x);printf("%f",a*x*x*x+b*x*x+c);}2、#includevoidmain(){inta,b;scanf("a=%d,b=%d",&a,&b);printf("ji=%d,shang=%d,yushu=%d",a*b,a/b,a%b);}3、#includevoidmain(){floatc,f;printf("请输入一个华氏温度f:");scanf("%f",&f);c=5.0/
5、9.0*(f-32);printf("摄氏温度为:%5.2f",c);}4、#include#definePI3.14159voidmain(){floatr,l,s;printf("请输入圆半径(r):");scanf("%f",&r);l=2*PI*r;s=r*r*PI;printf("圆周长l=%6.2f",l);printf("圆面积s=%6.2f",s);}5、#includevoidmain(){floatc=3.123456789;printf("%f",c);·举报
6、·2010-05-2214:16
7、·回复·郑大男人8楼}6、#includevoidmain(){inta=2;a+=a;printf("%d",a);a-=2;printf("%d",a);a*=2+3;printf("%d",a);a/=a+a;printf("%d",a);实验三1、#includevoidmain(){inta=3,b=4,c=5;floatx=1.414,y=1.732,z=2.712;printf("a=%-7db=%-7dc=%-7dx=%-7.3fy=%-7.3fz=%-7.3f",a,b,c,x,y,z);}2、#
8、includevoidmain(){inta,b,c;floatx,y,z;scanf("%d",&a);scanf("%d",&b);scanf("%d",&c);scanf("%f",&x);scanf("%f",&y);scanf("%f",&z);printf("a=%d,b=%d,c=%dx=%.3f,y=%.3f,z=%.3f,",a,b,c,x,y,z);}3、#includevoidmain(){inta,b,c,x1,x2;scanf("%d,%d,%d",&a,&b,&c);