The answer is really off, I think it has to do with the way I'm setting up the pi or the 4/3 part but I don't know how to fix it..
#include <conio.h>
#include <math.h>
#include <iostream.h>
#include <iomanip.h>
int main ()
{
double pi = 3.14159;
int r;
cout << "What is the length of the radius?" << endl;
cin >> r;
cout << "The volume of the sphere is " << 4/3*pi*pow(r, 3) << " units^3" << endl;
return 0;
}
Any help would be great thanks!!!
Last edited on
#include <conio.h>
#include <math.h>
#include <iostream.h>
#include <iomanip.h>
int main ()
{
float pi = 3.14159;
float r;
cout << "What is the length of the radius?" << endl;
cin >> r;
cout << "The volume of the sphere is " <<(4.0/3)*pi*pow(r, 3) << " units^3" << endl;
return 0;
}
Last edited on
Thank you so much :)
Last edited on