Advertisement
murad45

Circle & Cubic Challenge

Sep 18th, 2021
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.27 KB | None | 0 0
  1. /************************Circle Challange*******************/
  2.  
  3. #include <iostream>
  4. #include <math.h>
  5. #include <stdio.h>
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11.     cout << "Circle Calculator" << endl;
  12.     double radius;
  13.     double diameter,area,circumference;
  14.     double Pi = 3.14;
  15.  
  16.  
  17.     cout << "Enter Radius: "; // Type a Radius and press enter
  18.     cin >> radius;
  19.     diameter = 2 * radius;
  20.     cout << "\nDiameter: "<< diameter;
  21.     circumference = diameter * Pi;
  22.     cout << "\nCircumference: "<< circumference;
  23.     area = Pi * pow(radius,2.0);
  24.     cout << "\nArea: "<< area;
  25.     cout << "\n\nBye!";
  26.  
  27.     return 0;
  28. }
  29. /************************Cubic Challange*******************/
  30. #include <iostream>
  31. #include <math.h>
  32. #include <stdio.h>
  33.  
  34. using namespace std;
  35.  
  36. int main()
  37. {
  38.     cout << "Cubic Calculator:" << endl;
  39.     double length;
  40.     double volume,area,circumference;
  41.  
  42.  
  43.     cout << "\n\nEnter the side length of the cubic: "; // Type a Radius and press enter
  44.     cin >> length;
  45.     circumference = 12 * length;
  46.     cout << "\nCircumference: "<< circumference;
  47.     area = 6 * pow (length, 2.0);
  48.     cout << "\nArea: "<< area;
  49.     volume = pow (length, 3.0);
  50.     cout << "\nVolume: "<< volume;
  51.     cout << "\n\n\nSee you later!";
  52.  
  53.     return 0;
  54. }
  55.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement