Advertisement
bobo_bobkata

Untitled

Jun 8th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main(){
  6.  
  7. double radius;
  8.  
  9. //Read input
  10. cin >> radius;
  11.  
  12. //Set proper value for PI
  13. double pi = 3.14159265359;
  14.  
  15. //Calculate area
  16. double area = pi * radius * radius;
  17.  
  18. //Calculate perimeter
  19. double perimeter = 2 * pi * radius;
  20.  
  21. //Print output
  22. cout << "Area = " << area << endl;
  23. cout << "Perimeter = " << perimeter << endl;
  24.  
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement