#include
#define T 3.141592654
double Syuan(float r)
{
double s=T*r*r;//s
位圆的面积
此刻
s=T*r*r
有效超出
7
位了所以用
double
return s;
}
double Cyuan(float r)
{
double c=2*T*r;//c
为圆的周长
此刻
c=2*T*r
有效超出
7
位了所以用
double
return c;
}
void main()
{
float r;
printf("please input the r of a circle:");
scanf("%f",&r);
printf("the circle's square is:% .8f\n",Syuan(r));
printf("the circle's circumference is:% 6.2f\n",Cyuan(r));//%6.2f
整数部分保留
6
位,
小
数部分保留
2
位,并四舍五入
}
//
类型
比特数
有效数字
数值范围
//
float
32
6-7
-3.4*10(-38)
~
3.4*10(38)
//
double
64
15-16
-1.7*10(-308)
~
1.7*10(308)
//
long double
128
18-19
-1.2*10(-4932)
~
1.2*10(4932)