- 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

In this tutorial, we will be discussing a program to find the side of the octagon inscribed within a given square.

For this, we will be given with the side of a square and our task is to find the side of the largest octagon that can be inscribed in it.

Finding the relation between the sides of the square and the octagon, we find the formula for the side of the octagon

**side of square/(√2 + 1)**

#include <bits/stdc++.h> using namespace std; //calculating the side of the octagon float calc_oside(float a) { if (a < 0) return -1; float s = a / (sqrt(2) + 1); return s; } int main() { float a = 41; cout << calc_oside(a) << endl; return 0; }

16.9828

- Related Questions & Answers
- Area of decagon inscribed within the circle in C Program?
- C Program for area of decagon inscribed within the circle?
- Biggest Reuleaux Triangle inscribed within a square which is inscribed within a hexagon in C?
- Biggest Reuleaux Triangle inscribed within a square which is inscribed within an ellipse in C?
- Biggest Reuleaux Triangle inscribed within a square which is inscribed within a hexagon?
- Biggest Reuleaux Triangle inscribed within a square which is inscribed within an ellipse?
- Biggest Reuleaux Triangle inscribed within a square inscribed in a semicircle in C?
- Program to calculate the area of an Circle inscribed in a Square
- Biggest Reuleaux Triangle inscribed within a Square inscribed in an equilateral triangle in C?
- Biggest Reuleaux Triangle inscribed within a Square inscribed in an equilateral triangle?
- Biggest Reuleaux Triangle within a Square which is inscribed within a Circle in C?
- C++ program to find the Area of the Largest Triangle inscribed in a Hexagon?
- Area of circle inscribed within rhombus in C Program?
- Biggest Reuleaux Triangle within a Square which is inscribed within a Circle?
- Biggest Square that can be inscribed within an Equilateral triangle in C?

Advertisements