Menu Close

Volume of the VolleyBall in C Program…FcukTheCode

Laasya bought a new volleyball in the sports shop. It looks like a medium size. She somehow found the radius of the sphere. But she would like to know the volume of that ball.
Can you help him in finding the Volume of the ball?

Functional Description:
Volume = (4.0/3.0) × π × r^3
π = 3.14

Constraint:
1.00 ≤ r ≤ 5.00

Input Format :
The only line of input has a single value of type float representing the radius of the ball.

Output Format:
Print the volume of the ball in a single line.

#include <stdio.h>
#include <math.h>
int main()
{
    float radiusofball,volumeofball;
    float PI=3.14;
    //printf("Radius : ");
    scanf("%f",&radiusofball);
    volumeofball=(4.0/3.0)*PI*radiusofball*radiusofball*radiusofball;
    //printf("Volume : ");
    printf("%f",volumeofball);
	return 0;
}

Input_1:
Radius : 2.56

Output:
Volume : 70.240608


Input_2:
Radius : 3.1

Output:
Volume : 124.724976


 


Input_3:
Radius : 5.2

Output:
Volume : 588.678772


Input_4:
Radius : 1.22

Output:
Volume : 7.602351


Input_5:
Radius : 1

Output:
Volume : 4.186667


ILLUSTRATION OF THE OUTPUT : 

Executed using gcc linux