Friday, March 7, 2014

WRITE A FUNCTION TO FIND VOLUME OF A SPHERE

#include<conio.h>
#include<stdio.h>
#define PI 3.14
void main()
{
float volume(int);
int r;
float vol;
clrscr();
printf("enter the radius\n");
scanf("%d",&r);
vol=volume(r);
printf("the volume of sphere is %f",vol);
getch();
}

float volume(int r)
{
float v;
v=(4*PI*r*r*r)/3;
return(v);
}

No comments:

Post a Comment