游客 Signup | Login
中文 | En

3807 - 第二章:实数运算《练习6:求圆的面积》

输入圆的半径r,求圆的面积和周长。

pi=3.1415926535

面积=pi*r*r 

周长=2*pi*r

Input

输入一个实数r,表示圆的半径

Output

第一行,输出圆的面积(保留两位小数)

第二行,输出圆的周长(保留两位小数)

Examples

Input

3

Output

28.27
18.85

Solution C

#include <stdio.h>

#define PI 3.1415926535

int main(void) {
	double r;
	scanf("%lf", &r);
	printf("%.2f\n%.2f\n", PI*r*r, 2*PI*r);
	return 0; 
}

Solution C++

#include<cstdio>
using namespace std;
int main()
{
	double r,s,l;
	scanf("%lf",&r);
	s=r*r*3.1415926535;
	l=2*r*3.1415926535;
	printf("%.2lf\n",s);
	printf("%.2lf\n",l);
	return 0;
}
Time Limit 1 second
Memory Limit 128 MB
Discuss Stats
上一题 下一题