URI Online Judge | 1011 Sphere (Solution)

Problem Link:
https://www.urionlinejudge.com.br/judge/en/problems/view/1011

URI Online Judge | 1011

Sphere

Adapted by Neilor Tonin, URI  Brazil
Timelimit: 1
Make a program that calculates and print the volume of a sphere given the radius (R) of the circle. The formula to calculate the volume is: (4/3) * pi * R3. For the purposes of this problem the value of pi is 3.14159.
Tip: Use (4/3.0) or (4.0/3) in your formula, because some languages (including C++) assume that the result dividing two integers is another integer. :)

Input

The input file contain an integer number.

Output

The output file will contain a message like the following example. Remember the space before and after the equal signal. The value must be printed with 3 digits after the decimal point.
Sample InputsSample Outputs
3VOLUME = 113.097
15VOLUME = 14137.155
1523VOLUME = 14797486501.627
Solution:

#include<stdio.h>
int main(){
int R;
double pi=3.14159;
scanf("%d",&R);
printf("VOLUME = %.3lf\n",(4/3.0*pi*R*R*R));
return 0;
}

Comments

Popular posts from this blog

URI Online Judge | 1036 Bhaskara's Formula (Solution)

URI Online Judge | 1043 Triangle (Solution)

URI Online Judge | 1042 Simple Sort (Solution)