
- 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
Area of a square from diagonal length in C++
The area of a figure is the extent of the figure in two-dimensional plane.
Square is a quadrilateral with all its sides equal and all internal angles are right angles.
Diagonal of a polygon is the line joining two sides that are not adjacent to each other.
ac and bd are the diagonal of the square abcd.
In this problem, we are given the length of diagonals of a square and we have to find are of the square.
Now in triangle abc,
ac2 = bc2 + ab2 d2 = a2 + a2 d = sqrt(2*a2) d2 /2 = a2
And we know are of square = a * a.
Therefore,
area = d2 /2
Using this formula we can find the area of a square when the length of diagonal is given,
Example
#include<iostream> #include<math.h> using namespace std; int main(){ double d = 10; double area = (d * d)/2.0; cout<<"Area of square of diagonal "<<d<<" is "<<area; return 0; }
Output
area of square of diagonal 10 is 50
- Related Questions & Answers
- Area of hexagon with given diagonal length in C Program?
- C Program for area of hexagon with given diagonal length?
- Area of a Circumscribed Circle of a Square in C++
- Find length of Diagonal of Hexagon in C++
- Program for Area Of Square in C++
- Area of a leaf inside a square in C Program?
- Area of a leaf inside a square?
- Python Program to Remove First Diagonal Elements from a Square Matrix
- Find Maximum side length of square in a Matrix in C++
- Java program to find the area of a square
- Java Program to Find Area of Square
- C++ Program for Area Of Square after N-th fold
- Finding the length of the diagonal of a cuboid using JavaScript
- Area of a square inscribed in a circle which is inscribed in a hexagon in C Program?
- Area of a n-sided regular polygon with given side length in C++
Advertisements