Welcome

>>>Welcome to my "CODE BAZAR"
Code marshal
URI online judge
Others
Code marshal
URI online judge
Others
Code marshal
URI online judge
Others

Update ✔✔✔ Upcoming programming book (.pdf) "Programming Contest (data structures and algorithms) by Md. Mahbub Hasan & "Graph Algorithms" by Safayat Asraf "****** Date: 20 March, 2019****Hazrat Ali****

Thursday, 10 November 2016

URI-1011

URI Online Judge | 1011

Sphere

Adapted by Neilor Tonin, URI  Brazil
Timelimit: 1
Problem link Click here
Make a program that calculates and shows the volume of a sphere being provided the value of its radius (R) . The formula to calculate the volume is: (4/3) * pi * R3. Consider (assign) for pi the value 3.14159.
Tip: Use (4/3.0) or (4.0/3) in your formula, because some languages (including C++) assume that the division's result between two integers is another integer. :)

Input

The input contains a value of floating point (double precision).

Output

The output must be a message "VOLUME" like the following example with a space before and after the equal signal. The value must be presented with 3 digits after the decimal point.
Input SamplesOutput Samples
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;
}

No comments:

Post a Comment