for(r=1; r<=999;r++)
{
cout << "Please insert the value of r from 0-999:";
cin >> r;
volume = (4/3)*(pi)*(r*r*r);
cout<< "Radius:"<< r<< "\t";
cout<<"Volume:"<<volume<<"\n"<<"\n";
}
total_volume += volume;
cout<<"The total volume is:"<<total_volume;
Write a program to compute and print the volume of a sphere using the formula:
You may use r*r*r to compute r3.
Your program will prompt the user to enter a series of radius readings and the last value read is the
sentinel 999 (i.e. to end input, the user has to type 999 as the last value). After that, it will display the
corresponding volume in a neat format as shown in the output below. Your program should also calculate
the total volume of all the spheres.