C++ program to find circumference of the circular pond with radius R


Suppose we have a number R, represents the radius of a pond. We have to find the circumference of this pond.

So, if the input is like R = 73, then the output will be 458.67252742410977361942

Steps

To solve this, we will follow these steps −

res := r * 2 * cos-inverse (-1)
return res

Let us see the following implementation to get better understanding

Example

Let us see the following implementation to get better understanding −

#include<bits/stdc++.h>
using namespace std;

double solve(int r){
   double res = r * 2 * acos(-1);
   return res;
}
int main(){
   int R = 73;
   cout << solve(R) << endl;
}

Input

73

Output

458.673

Updated on: 03-Mar-2022

59 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements