
- 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 of a Pentagon in C++
In this problem, we are given a number n that denotes that side of the pentagon. Our task is to create a program to find the Area of a Pentagon in C++.
Pentagon is a five-sided geometric figure.
Regular pentagon is a pentagon with all five sides and angles equal.
Let’s take an example to understand the problem,
Input
a = 7
Output
84.3
Program to illustrate the working of our solution,
Example
#include <iostream> using namespace std; float calcpentagonArea(int a){ return ( ((6.8819)*a*a)/4); } int main() { int a = 7; cout<<"The area of regular pentagon of side "<<a<<" is"<<calcpentagonArea(a); return 0; }
Output
The area of regular pentagon of side 7 is 84.3033
- Related Articles
- Swift Program to Calculate Area of Pentagon
- Diagonal of a Regular Pentagon in C++ Program
- Program to find the Area of a Parallelogram in C++
- C Program for Program to find the area of a circle?
- Program to find area of a Circular Segment in C++
- Program to find the Area and Perimeter of a Semicircle in C++
- Program to find the Area of an Ellipse in C++
- Diagonal of a Regular Pentagon in C++?
- Program to find the Area and Volume of Icosahedron in C++
- C++ program to find the Area of the Largest Triangle inscribed in a Hexagon?
- Program to find the Area of an Ellipse using C++
- C++ Program to Find Largest Rectangular Area in a Histogram
- Java program to find the area of a square
- Java program to find the area of a rectangle
- Java program to find the area of a triangle

Advertisements