首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

教教小弟我 .如何写 才不会0分~(><)~

2012-08-24 
教教我....怎么写才不会0分~~~~(_)~~~~题目描述Given the radius of a circle, calculate its area.输入

教教我 ....怎么写 才不会0分~~~~(>_<)~~~~
题目描述

Given the radius of a circle, calculate its area.
输入描述

One real number r.
输出描述

Output the area with an error no more than 0.001
样例输入

1.0样例输出

3.1415926
用C来解 (*^__^*) 嘻嘻……

[解决办法]
#include <stdio.h>
#include <string.h>

#define PI 3.1415926
int main(int argc,char **argv)
{
double r = 4.1122933;
double area = r*r*PI;
printf("%.16lf\n",area);
}

不知道是不是这个意思?
[解决办法]
1 #include <stdio.h>
2 #include <math.h>

4 #define PI 3.1415926

6 int main(void)
7 {
8 float radium = 0.0;
9 double area = 0.0;
 10
 11 puts("Please input the cycle's radium: ");
 12 scanf("%f", &radium);
 13
 14 area = PI * pow(radium, 2);
 15
 16 printf("The area is : %.3lf\n", area);
 17 return 0;
 18 }

热点排行