C++ Program to calculate the volume and surface of the sphere. | सी + + क्षेत्र की मात्रा और सतह की गणना करने के लिए कार्यक्रम।

C++ Program to calculate the volume and surface of the sphere.

Let see the program to calculate the volume and surface of the sphere.

Example:
  1. Formula:

    surface of sphere and volume of sphere
    sphere

/* to calculate the volume of the sphere. */ #include <iostream> using namespace std; int main() { float radius,height,volume; cout<<"Enter radius of sphere :"; cin>>radius; volume=(4/3)*(22/7)*radius*radius*radius; cout<<"volume of sphere = "<<volume<<" units."<<endl; return 0; }
Output:
Enter radius of sphere :7.5 volume of sphere = 1265.62 units.
/* to calculate the surface of the sphere. */ #include <iostream> using namespace std; #include <math.h> int main() { float radius,height,surface; cout<<"Enter radius of sphere :"; cin>>radius; surface=4*(22/7)*radius*radius; cout<<"surface of sphere = "<<surface<<" sq. units."<<endl; return 0; }
Output:
Enter radius of sphere :2.7 surface of sphere = 87.48 sq. units.