C程序题库讲述.docVIP

  • 39
  • 0
  • 约6.39万字
  • 约 92页
  • 2017-03-03 发布于湖北
  • 举报
C程序题库讲述

C程序题库 【程序2】 题目:有函数F(x)=(x+1)2和G(x)=2x+1,输入X值计算F(G(x))的值。 #include stdio.h #include math.h void main() { float x,y; printf(Please input x:); scanf(%f,x); y=2*x+1; y=(float)pow(y+1,2); printf(The result is:%f\n,y); } #include stdio.h void main() { char a,b,c; printf(Please input 3 characters:); scanf(%c%c%c,a,b,c); printf(%c%c%c,c,b,a); printf(%c%c%c,a,b,c); printf(\n); } 【程序4】 题目:求圆面积。根据输入的半径,计算并输出圆的面积。 程序分析:圆面积公式 s = 3.1415 * r * r,注意r和s应该为float类型。 程序源代码: #include stdio.h void main() { float r; float PI=3.1415f; float s; printf(请输入圆的半径:); scanf(%f,r); s=PI*r*r; //整数的格式占

文档评论(0)

1亿VIP精品文档

相关文档