I have a project in my C Programing class,but I am having a little trouble.I have to create a user defind function, for finding the volume of a sphere given the radius.
The function should be called "sphere_volume) and called from the main program.
When it is called from the main program it will look like this: sphere_volume(r);
This is what I have so far but I keep getting errors. Any suggestions? THANKS
Code:
// Class Redo.cpp : Defines the entry point for the console application.
#include "stdafx.h"
#include "math.h"
double sphere_volume(double r, int v);
int/* _t */ main (void) //(int argc, _TCHAR* argv[])
{
double r,
v;
/* ASK FOR RADIUS */
printf("Enter the radius of the circle:"),
scanf ("%lf", &r);
/* OUTPUT VOLUME */
printf("The volume is %f \n",sphere_volume (r));
return 0;
}
double sphere_volume ( double r)
{
v=4/3*3.14*pow(r,3) ;
return (v);
}