
- C++ Basics
- C++ Home
- C++ Overview
- C++ Environment Setup
- C++ Basic Syntax
- C++ Comments
- C++ Data Types
- C++ Variable Types
- C++ Variable Scope
- C++ Constants/Literals
- C++ Modifier Types
- C++ Storage Classes
- C++ Operators
- C++ Loop Types
- C++ Decision Making
- C++ Functions
- C++ Numbers
- C++ Arrays
- C++ Strings
- C++ Pointers
- C++ References
- C++ Date & Time
- C++ Basic Input/Output
- C++ Data Structures
- C++ Object Oriented
- C++ Classes & Objects
- C++ Inheritance
- C++ Overloading
- C++ Polymorphism
- C++ Abstraction
- C++ Encapsulation
- C++ Interfaces
Program to find the Area and Perimeter of a Semicircle in C++
In this problem, we are given a value that denotes the radius of a semicircle. Our task is to create a program to find the Area and Perimeter of a Semicircle in C++.
SemiCircle is a closed figure that is half of a circle.
Let’s take an example to understand the problem,
Input
R = 5
Output
area = 39.25 perimeter = 15.7
Solution Approach
To solve the problem, we will use the mathematical formula for the area and perimeter of a semi-circle which is derived by dividing the area of circle by 2.
Area of semicircle,A= $½(\prod^*a^2)=1.571^*a^2$
Perimeter of semicircle, P =(π*a)
Area of semicircle, area = $½(π^*a^2)$
Program to illustrate the working of our solution
Example
#include <iostream> using namespace std; float calaAreaSemi(float R) { return (1.571 * R * R); } float calaPeriSemi(float R) { return (3.142 * R); } int main(){ float R = 5; cout<<"The radius of semicircle is "<<R<<endl; cout<<"The area of semicircle is "<<calaAreaSemi(R)<<endl; cout<<"The perimeter of semicircle is "<<calaPeriSemi(R)<<endl; return 0; }
Output
The radius of semicircle is 5 The area of semicircle is 39.275 The perimeter of semicircle is 15.71
- Related Articles
- JavaScript program to find Area and Perimeter of Rectangle
- Program to calculate area and perimeter of Trapezium
- Find the perimeter of the adjoining figure, which is a semicircle including its diameter."
- Program to calculate area and perimeter of equilateral triangle
- Golang Program to Create a Class and Compute the Area and Perimeter of a Circle
- Program to calculate area and perimeter of equilateral triangle in C++
- C Program for Area And Perimeter Of Rectangle
- Swift Program to Calculate Area and Perimeter of Equilateral Triangle
- Python Program to Create a Class and Compute the Area and the Perimeter of the Circle
- Find the perimeter and area of the shaded region."\n
- Find the area and perimeter of the parallelogram: "\n
- Find the perimeter and area of the following figure:"\n
- Find the area and perimeter of right triangle in PL/SQL
- Find the area and perimeter of a square of side of 4 cm.
- Explain the perimeter and area of a triangle.

Advertisements