Javatpoint Logo
Javatpoint Logo

Program to find the area and perimeter of the semicircle

In this article, we will discuss the program to find the area and perimeter of semicircle in different programming languages.

But before writing the programs, let's first see a brief description of the semicircle and the formulae to find its area and perimeter.

Semicircle

When a line passes through the center and touches the two ends of the circle, then a semicircle is formed. The diameter of a circle divides it into two halves that are referred to as semicircles. A semicircle is the half part of a circle.

Program to find the area and perimeter of the semicircle

Area of semicircle

The area of semicircle is equal to half of the area of a circle. When we divide the area of a circle by 2, we will get the area of the semicircle.

The area of a circle is πr2. So, the area of semicircle will be -

Area of semicircle =1/2( πr2)

The perimeter of a semicircle is equivalent to the sum of diameter and half of the circumference of a circle.

The formula for perimeter of the circle can be πd or 2πr (where 'd' is diameter and 'r' is the radius). So, the formula to calculate the perimeter of a semicircle is -

Now, let's see the programs to find the area and perimeter of the semicircle.

Programs to find the area and perimeter of the semicircle

In the programs, we are using the formulae given below -

Program: Write a program to find the area and perimeter of semicircle in C language.

Output:

Program to find the area and perimeter of the semicircle

Program: Write a program to find the area and perimeter of semicircle in C++ language.

Output:

Program to find the area and perimeter of the semicircle

Program: Write a program to find the area and perimeter of semicircle in python language.

Output:

After the execution of the above code, and after entering the value of the radius, the output will be -

Program to find the area and perimeter of the semicircle

Program: Write a program to find the area and perimeter of semicircle in Java.

Output:

Program to find the area and perimeter of the semicircle

Program: Write a program to find the area and perimeter of semicircle in JavaScript.

Output:

After the execution of the above code, the output will be -

Program to find the area and perimeter of the semicircle

After entering the value and clicking on OK, the output will be -

Program to find the area and perimeter of the semicircle

Program: Write a program to find the area and perimeter of semicircle in C#.

Output:

Program to find the area and perimeter of the semicircle

Program: Write a program to find the area and perimeter of semicircle in PHP.

Output:

Program to find the area and perimeter of the semicircle

So, that's all about the article. Here, we have discussed the programs to find the area and perimeter of semicircle in C, C++, Java, C#, PHP, python, and JavaScript. Hope you find the article helpful and informative.


Next TopicPrograms List





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA