
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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
Find Circumference of Circular Pond with Radius r in C++
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
Advertisements