- 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 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**

d = 15

67.5, 82.5, 97.5, 112.5

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

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**

#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; }

The angles of the quadrilateral are: 52.5 77.5 102.5 127.5

- Related Questions & Answers
- C++ program to find fourth side of a quadrilateral
- Java Program to find all angles of a triangle
- Program to find smallest difference of angles of two parts of a given circle in C++
- Maximum area of quadrilateral in C++
- Find other two sides and angles of a right angle triangle in C++
- C# Program to find the sum of a sequence
- C++ Program to Find the Length of a String
- C program to find the length of a string?
- Program to find the Area of a Parallelogram in C++
- Program to find the Area of a Pentagon in C++
- Program to find the initials of a name in C++
- C Program for Program to find the area of a circle?
- C# program to find the index of a word in a string
- C++ Program to Find the Frequency of a Character in a String
- C++ Program to Find the Edge Connectivity of a Graph

Advertisements