Advertisement
Griwin

HomeWork C++ ex

Oct 6th, 2022
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | Source Code | 0 0
  1.  
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. double const PI = 3.14; // Global variable
  7.  
  8. double areaCircle (int r){
  9.    double area = PI * r * r;
  10.     std::cout << "Circle Area=" << area << std::endl;
  11.     return area;
  12. }
  13.  
  14. double perimeterCircle (int r){
  15.    double perimeter =  PI * 2 * r;
  16.     std::cout << "Circle perimeter=" << perimeter << std::endl;
  17.     return perimeter;
  18. }
  19.  
  20. int main()
  21. {
  22.   unsigned double r;
  23.   cout << "Enter radius ";
  24.   cin >> r ;
  25.  
  26.   areaCircle(r);
  27.   perimeterCircle(r);
  28.     return 0;
  29. }
  30.  
  31. //A = π r²
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement