Advertisement
Spocoman

Cone

Sep 17th, 2023
573
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #define _USE_MATH_DEFINES
  2. #include <iostream>
  3. #include <string>
  4. #include <cmath>
  5.  
  6. using namespace std;
  7.  
  8. int main() {
  9.     double radius, height;
  10.     cin >> radius >> height;
  11.  
  12.     double volume = M_PI * radius * radius * height / 3;
  13.  
  14.     double area = M_PI * radius * (radius + sqrt(radius * radius + height * height));
  15.  
  16.     printf("volume = %.4f\narea = %.4f\n", volume, area);
  17.  
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement