612. The volume of the ball

612. The volume of the ball

Given your radius R of a sphere, please calculate the volume of the sphere.

The formula for calculating the sphere is V=(4/3)∗π∗R^3.

π takes 3.14159.

Note: 1.3333... is not available in some languages ​​(4/3). It is recommended to use (4/3.0) in the formula.

Input format

Enter an integer R.

Output format

The output format is "VOLUME = X", where X is the volume of the sphere, and the result is to three decimal places.

data range

1≤R≤2000

Input sample:

3

Sample output:

VOLUME = 113.097
//C语言中 4/3要用 4/3.0 表示,分数不能用手写的那种格式



#include <cstdio>

int main()
{
	int r;
	double pi = 3.14159;
	scanf("%d", &r);
	printf("VOLUME = %.3lf", (4/3.0) * pi * r * r * r);
	
	
	return 0;
} 

Guess you like

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