Respuesta :
Answer:
Following is C++ program to check the buoyancy of sphere:
#include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
double radius, weight, fb, vol, y = 62.4;
cout<<"Enter the weight of sphere"<<endl;
cin>>weight;
cout<<"Enter the radius of sphere"<<endl;
cin>>radius;
vol = (4/3)*3.14*radius*radius*radius;
fb = vol*y;
if(fb>=weight)
cout<<"Sphere will float"<<endl;
else
cout<<"Sphere will sink"<<endl;
return 0;
}
Output:
Enter the weight of sphere
545.63
Enter the radius of sphere
5
Sphere will float
Explanation:
The program will ask the user to input weight and radius of sphere. Using the value of radius the program will calculate the volume of sphere as per given formula. And using the volume it will next calculate the buoyant force.
Then using if condition the program will check the obtained buoyant force is grater than the weight of object to know if it will float or not.
In this exercise we have to use the knowledge in computational language in C++ to write the following code:
We have the code can be found in the attached image.
So in an easier way we have that the code is:
#include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
double radius, weight, fb, vol, y = 62.4;
cout<<"Enter the weight of sphere"<<endl;
cin>>weight;
cout<<"Enter the radius of sphere"<<endl;
cin>>radius;
vol = (4/3)*3.14*radius*radius*radius;
fb = vol*y;
if(fb>=weight)
cout<<"Sphere will float"<<endl;
else
cout<<"Sphere will sink"<<endl;
return 0;
}
See more about C++ at brainly.com/question/19705654
