C Programs | IT Developer
IT Developer

C Programs



Share with a Friend

C Program: Surface Area of a Hemisphere

Introduction

A hemisphere is half of a sphere. It has two parts in its surface area:

  1. Curved Surface Area (CSA):

2πr2

  1. Total Surface Area (TSA):

3πr2

where

  • r = radius of the hemisphere
  • π (pi) ≈ 3.14159

In this program, we will calculate the Total Surface Area (TSA).

 

C Program: Surface Area of a Hemisphere

C

#include <stdio.h>

#define PI 3.14159   // Define constant PI

 

int main() {

    float radius, surface_area;

 

    // Input radius

    printf("Enter the radius of the hemisphere: ");

    scanf("%f", &radius);

 

    // Calculate total surface area

    surface_area = 3 * PI * radius * radius;

 

    // Display result

    printf("Surface Area of Hemisphere = %.2f\n", surface_area);

 

    return 0;

}

Output

 
OUTPUT 1 :
Enter the radius of the hemisphere: 6
Surface Area of Hemisphere = 339.29



OUTPUT 2 :
Enter the radius of the hemisphere: 4.5
Surface Area of Hemisphere = 190.85



Explanation

  • The user inputs the radius of the hemisphere.
  • Formula applied: 3 × π × r².
  • The program prints the total surface area with two decimal places.