- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 find the angles of a quadrilateral in C++
In this problem, we are given a value d, which is the common difference of AP. This AP is all the angles of a quadrilateral. Our task is to create a program to find the angles of a quadrilateral in C++.
Problem Description − Here, the angles of the quadrilateral are in the form of an AP with common difference d. And we need to find the angles.
Let’s take an example to understand the problem
Input
d = 15
Output
67.5, 82.5, 97.5, 112.5
Explanation
First angle is x Second angle is x + 15 Third angle is x + 30 Four angle is x + 45
Sum of angles of a quadrilateral is 360.
x + x + 15 + x + 30 + x + 45 = 360 4x + 90 = 360 4x = 270 => x = 67.5
Solution Approach
To solve this problem, we will use the properties of AP and quadrilateral.
We will take the 1st four angles of AP starting with x. They will be x, x+d, x+2d, x+3d.
The sum of all the angles of a quadrilateral is 360. Considering this
x + x+d + x+2d + x+3d = 360 4x + 6d = 360 2x + 3d = 180 => x = (180 - 3d)/2
Using this formula we will find the value of one angle of the quadrilateral as we know the value of d. We will be able to find all the rest angles too.
Program to illustrate the working of our solution
Example
#include <iostream> using namespace std; float findAngle(float d){ return ((180 - (3*d))/2); } int main(){ float d = 25; float a = findAngle(d); cout<<"The angles of the quadrilateral are: "<<a<<"\t"<<(a+d)<<"\t"<<(a+ 2*d)<<"\t" <<(a+3*d); return 0; }
Output
The angles of the quadrilateral are: 52.5 77.5 102.5 127.5
- Related Articles
- The angles of quadrilateral are in the ratio $3: 5: 9: 13 $ Find all the angles of the quadrilateral.
- In a quadrilateral angles are in the ratio 2:3:4:7 . Find all the angles of the quadrilateral. Is it a convex or a concave quadrilateral
- ABCD is a cyclic quadrilateral (see figure). Find the angles of the cyclic quadrilateral."
- C++ program to find fourth side of a quadrilateral
- The angles of a quadrilateral are in the ratio $3: 4: 6: 7$. Find the four angles.
- The angles of a quadrilateral are in A.P. whose common difference is $10^o$. Find the angles.
- The angles of a quadrilateral are in the ratio $3: 4: 5: 6$. Find the measure of the angles.
- Two angles of a quadrilateral are $3x - 4$ each and two are $3x + 10$ each. Find all four angles of the quadrilateral.
- In a quadrilateral $ABCD$, the angles $A, B, C$ and $D$ are in the ratio $1 : 2 : 4 : 5$. Find the measures of each angle of the quadrilateral.
- The opposite sides of a quadrilateral are parallel. If one angle of the quadrilateral is $60^o$, find the other angles.
- If the angles of a quadrilateral are $4x, 3x+10^o, 2x+10^o$ and $4x+15^o$, then find the angles.
- Java Program to find all angles of a triangle
- What is the Sum of all exterior angles of quadrilateral?
- Program to find smallest difference of angles of two parts of a given circle in C++
- The angels of a quadrilateral are in the ratio 3 : 5 : 7 : 9, find the measure of each of these angles.
