- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- 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
Arc length from given Angle in C++?
An Angle is formed when two rays meet at a point. The point on the plane at which these rays meet is vertex.
Arc of a circle is a portion of the circumference that is described by an angle.
In this problem, we are given an angle of the circle. And we need to find the length of arc using the given diameter of the circle. For example,
Input : Angle = 45° Diameter = 28 Output : Arc = 11
Explanation
Length of arc = (circumference) X (angle/360°)
= (π * d)*(angle/360°)
To make a program that calculates the length of Arc from the given angle and diameter we will apply this formula.
Example
#include <iostream> using namespace std; int main() { double diameter = 28.0; double angle = 45.0; double pi = 22.0 / 7.0; double arc; if (angle >= 360) { cout<< "Angle cannot", " be formed"; } else { arc = (pi * diameter) * (angle / 360.0); cout<<"The length of arc = "<<arc; } return 0; }
Output
The length of arc = 11
Advertisements