604. The area of the circle

604. The area of ​​the circle

The formula for calculating the area of ​​a circle is defined as A=πR^2.

Please use this formula to calculate the area of ​​the given circle.

The value of π is 3.14159.

Input format

The input contains a floating point number, which is the radius of the circle R.

Output format

The output format is "A=X", where X is the area of ​​the circle, expressed as a floating point number with four decimal places.

data range

0<R<10000.000

Input sample:

2.00

Sample output:

A=12.5664

Idea code:

//这道题我用float就没有通过,99%的情况直接用double就好(除非遇到了空间限制题)



#include <cstdio>

int main()
{
	double pi = 3.14159, r;
	scanf("%lf",&r);
	printf("A=%.4lf\n", pi * r * r);
	
	return 0;
}

Guess you like

Origin blog.csdn.net/qq_42465670/article/details/114548412