- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Program to calculate Area Of Octagon

An octagon is a polygon with eight sides. To calculate the area of octagon the following formula is used,

Area of octagon = ((a^{2}*2) / *tan (22.5°)) = ((2*a*a)(1+√2))

Code Logic, The area of a polygon with eight side is calculated by using the above formula. The expression uses sqrt function to find the square root of 2. The value of expression is evaluated as a floating point value that is put into the float area variable.

## Example

#include <stdio.h> #include <math.h> int main(){ int a = 7; float area; float multiplier = 6.18; printf("Program to find area of octagon \n"); printf("The side of the octagon is %d \n", a); area = ((2*a*a)*(1 + sqrt(2))); printf("The area of Enneagon is %f \n", area); return 0; }

## Output

Program to find area of octagon The side of the octagon is 7 The area of Enneagon is 236.592926

- Related Questions & Answers
- Program to calculate area of Enneagon
- Program to calculate the area of a Tetrahedron
- Program to calculate area and perimeter of Trapezium
- Java Program to calculate area of a Tetrahedron
- Program to calculate area and perimeter of equilateral triangle
- Program to calculate area and volume of a Tetrahedron
- Python Program to calculate the area of a Tetrahedron
- Program to calculate area of Circumcircle of an Equilateral Triangle
- Program to calculate area and perimeter of equilateral triangle in C++
- Program to calculate area of Circumcircle of an Equilateral Triangle in C++
- Program to calculate the area of an Circle inscribed in a Square
- Program to calculate the area between two Concentric Circles in C++?
- C++ program to create one rectangle class and calculate its area
- Java Program to calculate the area of a triangle using Heron's Formula
- How to Calculate the Area of a Triangle using Python?

Advertisements