fork download
  1. #include <iostream>
  2. #include <cmath>
  3. #include <iomanip>
  4. using namespace std;
  5.  
  6. int main() {
  7. // your code goes here
  8.  
  9. double r ;
  10. double h ;
  11. double area ;
  12. double V ;
  13. double pi = 22/7 ;
  14. cout<< "Please enter radius of base " << endl ;
  15. cin >> r ;
  16. cout << "Please enter height of cylinder"<< endl ;
  17. cin >> h ;
  18. area = pi* pow(r,2);
  19. V= pi*pow(r,2)*h ;
  20. cout << "The area is "<<setprecision(4)<< area <<endl ;
  21. cout << "The volume is "<< setprecision(4)<< V << endl ;
  22.  
  23.  
  24. return 0;
  25. }
Success #stdin #stdout 0s 4276KB
stdin
4.9
9.98
stdout
Please enter radius of base 
Please enter height of cylinder
The area is 72.03
The volume is 718.9