bshy.net
当前位置:首页>>关于求写一个C语言程序 题目:分别编写求圆面积和圆周长...的资料>>

求写一个C语言程序 题目:分别编写求圆面积和圆周长...

如图:

#include#define Pi 3.14159double Square(double r){ return Pi * r * r;}double Perimeter(double r){ return 2 * Pi * r;}int main(){ double r; printf("请输入圆的半径:\n"); while(scanf("%lf",&r)!= EOF){ printf("圆的面积是%lf\n",Squ...

#include void main() { double r,s,l; printf("请输入圆的半径\n"); scanf("%lf",&r); s=3.14159*r*r; l=2*3.14159*r; printf("面积为%lf 周长为%lf\n",s,l); }

#include #define PI 3.14159void main(){float r;printf("请输入圆半径r的值: ");scanf("%f",&r);printf("圆面积S=%.2f",PI*r*r);}

void print(double r){ if (r 0 else printf("S = %lf, C = %lf\n", 3.14*r*r, 2*3.14*r);}

#include void main() { float r; //半径 printf("请输入圆的半径: "); scanf("%f",&r); printf("圆的周长是: %f\n",(2*3.14*r));//求出圆周长 printf("圆的面积是: %f\n",(3.14*r*r));//求出圆面积 }

#include"math.h" #include"stdio.h" #define pai=3.1415926 void main() { float r,l,s; printf("input r:\n"); scanf("%f",&r); l=2*r*pai; s=pai*r^2; printf("周长=%.2f\n,面积=%.2f\n",l,s); }

#include void main() { int r=5; double l,s,pi=3.1415926; l=2*pi*r; s=r*r*pi; printf("圆的周长=%lf\n圆的面积=%lf\n",l,s); } 或者你可以直接写 #include void main() { printf("圆的周长=31.415926\n圆的面积=78.539815f\n"); } C语言是一...

#include void main() { float r; printf("请输入圆的半径: "); scanf("%f",&r); printf("圆的周长是: %f\n",(2*3.14*r));//求出圆周长 printf("圆的面积是: %f\n",(3.14*r*r));//求出圆面积 }

1.面积表达式如下: #include #include void main() { double r; double s; double pi; pi = 3.1415926; printf("The radius:"); scanf("%lf",&r); s = pi*r*r; printf("The Area is:%g\n",s); } 2.周长表达式如下: #include #define PI 3.1415...

网站首页 | 网站地图
All rights reserved Powered by www.bshy.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com