www.qcfz.net > 编写程序,从键盘输入一个圆的半径值,求圆周长,...

编写程序,从键盘输入一个圆的半径值,求圆周长,...

#include #define P 3.1415926 int main() { double c, r, area; printf("请输入半径R="); scanf("%lf", &r); c = 2 * P * r; area = P* r * r; printf("周长为l=%f\n,面积s=%f\n", c, area); return 0; }

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

#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" void main() { float r,l,s; printf("input r:\n"); scanf("%f",&r); l=2*r*3.1415926; s=r*r*3.1415926; printf("周长=%.2f\n,面积=%.2f\n",l,s); }

没有说用什么语言,但从界面看似为C/C++,就给你提供一个…… #include "stdio.h" void main(void){ double d,pai=3.1415926; printf("请输入圆的半径...\nd="); scanf("%lf",&d); printf("圆的周长是:%lf 圆的面积是:%lf\n",2*pai*d,pai*d*d); }

方法: #include #define PI 3.14 int main() { float r,c,area; printf("请输入圆的半径:"); scanf("%f",&r); c=2 * PI * r; area=PI * r * r; printf("该圆的周长是%.2f,面积是%.2f\a",c,area); } 扩展资料一、圆的面积公式: 圆的面积计算...

/ test.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include #define PI 3.1415962 using namespace std; class circle { private: int r; //半径 public: circle() //无参数构造函数以10为半径 { r=1...

#include using namespace std;int main(){#define PI 3.14159265 double r, c, s; cin>>r; c=2*PI*r; s=PI*r*r; cout

#includeint main(){int n; //半径scanf("%d", &n);printf("周长: %d\n", 2 * 3.14*n);printf("面积: %d\n", 3.14*n*n);return 0;}

class Program { static void Main(string[] args) { double r=0,c,s; Console.WriteLine("Please Enter The R:"); try { r = Convert.ToDouble(Console.ReadLine()); } catch (Exception ex) { Console.WriteLine(ex.Message); } c = Math.PI *...

网站地图

All rights reserved Powered by www.qcfz.net

copyright ©right 2010-2021。
www.qcfz.net内容来自网络,如有侵犯请联系客服。zhit325@qq.com