Advertisement
Nofxthepirate

Exercise 2.20

Jan 24th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. //Exercise 2.20
  2. //This program accepts a radius of a circle and prints the diameter, circumference, and area
  3. #include <iostream>
  4. using namespace std;
  5.  
  6.  
  7. int main(){
  8.     int radius{};
  9.     cout << "Please input the radius of your circle: " << endl;
  10.     cin >> radius;
  11.     cout << "Diameter is " << radius * 2 << endl;
  12.     cout << "Circumference is " << 2 * 3.14159 * radius << endl;
  13.     cout << "Area is " << 3.14159 * radius * radius << endl;
  14.  
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement