Arc length from given Angle in C++?

C++Server Side ProgrammingProgramming

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


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.


 Live Demo

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


The length of arc = 11
Published on 03-Oct-2019 12:56:49