Saturday, December 28, 2013

1011 Sphere

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.

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 Input Sample Output
3
VOLUME = 113.097
 
Solution:
#include <stdio.h>
int main(){
    register int R;
    scanf("%d", &R);
    printf("VOLUME = %.3f\n", 4.188786*R*R*R);
    return 0;
}

No comments:

Post a Comment