c语言作业题五六章答案,C语言程序设计五六章习题和课堂测试答案.doc
C語言程序設計五六章習題和課堂測試答案
C語言程序設計第四五六章習題和課堂測試答案,還有期末C語言復習例題//3--1矩形面積 #includevoid main(){float a,b;float c,area;printf("n\Please Input a,b:");scanf("%f%f",&a,&b);c=(a+b)*2;area=a*b;printf("c=%f,area=%f\n",c,area);}//3--2輸入三位數,輸出它各個數位上的數字#includevoid main(){int m,a,b,c;printf("\nPlease Input 三位整數:");scanf("%d",&m);a=m/100;b=m/10%10;c=m%10;printf("a=%d,b=%d,c=%d\n",a,b,c);}//3--3大寫字母轉換#includevoid main(){char ch;printf("\nPlease Input 大寫字母:");scanf("%c",&ch);ch=(ch>='A'&&ch<='Z')?ch=ch+32:ch;printf("ch=%c\n",ch);}//3--3大寫字母轉換方法二#includevoid main(){char ch;printf("\nPlease Input 大寫字母:");scanf("%c",&ch);if (ch>='A'&&ch<='Z')ch=ch+32;printf("ch=%c\n",ch);}//4--1已知圓半徑和高,求周長,面積,表面積,體積和圓柱體積#define PI 3.14#include#includevoid main(){double r,h,c,area,s,v,u;printf("\n請輸入圓的半徑和高:");scanf("%lf%lf",&r,&h);c=2*PI*r;area=PI*pow(r,2);s=4*PI*pow(r,2);v=4.0/3*PI*pow(r,3);u=PI*pow(r,2)*h;printf("c=%lf,area=%lf,s=%lf,v=%lf,u=%lf\n",c,area,s,v,u);}//4--2輸入華氏溫度求攝氏溫度#includevoid main(){float F,C;printf("\n請輸入F:");scanf("%f",&F);C=(F-32)*5/9;printf("C=%f\n",C);}//4--3輸入五位整數,將它反向輸出#includevoid main(){int m,a,b,c,d,e,f;printf("請輸入五位整數:");scanf("%d",&m);a=m/10000;b=(m-a*10000)/1000;c=(m-a*10000-b*1000)/100;d=(m-a*10000-b*1000-c*100)/10;e=m-a*10000-b*1000-c*100-d*10;f=e*10000+d*1000+c*100+b*10+a;printf("%d對調后是%d\n",m,f);}//4--4人口#include#includevoid main(){double n,r;r=0.8/100;n=log(2)/log(r+1) ;printf("\n%lf年后我國人口超過26億",n);}
//4--5求二點間的距離#include#includevoid main(){float x1,y1,x2,y2,l;printf("請輸入平面坐標系中二個點的坐標x1 y1 x2 y2:");scanf("%f%f%f%f",&x1,&y1,&x2,&y2);l=pow(pow(x1-x2,2)+pow(y1-y2,2),0.5);printf("二點之間的距離為l=%f\n",l);}//求兩點間的距離方法2#include#includevoid main(){float x1,y1,x2,y2,l;printf("請輸入平面坐標系中二個點的坐標x1 y1 x2 y2:");scanf("%f%f%f%f",&x1,&y1,&x2,&y2);l=sqrt(pow(x1-x2,2)+pow(y1-y2,2));prin
總結
以上是生活随笔為你收集整理的c语言作业题五六章答案,C语言程序设计五六章习题和课堂测试答案.doc的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux git 删除分支,git 删
- 下一篇: 用户访问必应聊天出现错误,微软高管致歉并