c
A program that takes the radius of a sphere as an integer as input and outputs the volume of that sphere as a floating point number. V=4/3*Pi*r*r*r
#include <stdio.h>
int main()
{
int r; double v; double pi=22/7.0;
printf("Radius of sphere=");
scanf("%d",&r);
v=(4/3.0)*pi*r*r*r;//int division
printf("Volume of sphere=%lf",v);
return 0;
}
Was this helpful?