C Program To Calculate Surface Area of Sphere


Given the value for radius of a Sphere, write a C program to calculate Surface Area of the Sphere.

Formula To Calculate Surface Area of Sphere

When radius value is known: Area = 4 * π * radius²,
When diameter value is known: Area = π * diameter²,
When volume value is known: Area = ³√(36 * π * Volume²).

where π (PI) is approximately equal to 3.14

surface area of sphere

Related Read:
Basic Arithmetic Operations In C

Logic To Calculate Surface Area of Sphere

We ask the user to enter the value of radius of the sphere. We apply the formula:
Surface_ Area = 4 * PI * radius2
where π (PI) is approximately equal to 3.14

Expected Output for the Input

User Input:
Enter Radius of the Sphere
5

Output:
Surface Area of Sphere is 314.000000

Video Tutorial: C Program To Calculate Surface Area of Sphere



YouTube Link: https://www.youtube.com/watch?v=2llOHesCV70 [Watch the Video In Full Screen.]

Source Code: C Program To Calculate Surface Area of Sphere

  1. #include<stdio.h>  
  2.   
  3. int main()  
  4. {  
  5.     const float PI = 3.14;  
  6.           float r, area;  
  7.   
  8.     printf("Enter Radius of the Sphere\n");  
  9.     scanf("%f", &r);  
  10.   
  11.     area = ( 4 * PI * r * r );  
  12.   
  13.     printf("Surface Area of Sphere is %f\n", area);  
  14.   
  15.     return 0;  
  16. }  

Output 1:
Enter Radius of the Sphere
2
Surface Area of Sphere is 50.240002

Output 2:
Enter Radius of the Sphere
10
Surface Area of Sphere is 1256.000000

For list of all c programming interviews / viva question and answers visit: C Programming Interview / Viva Q&A List

For full C programming language free video tutorial list visit:C Programming: Beginner To Advance To Expert

Leave a Reply

Your email address will not be published. Required fields are marked *