fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main(){
  6. float r, h;
  7. cin>>r>>h;
  8. cout<<"surface area of the cone = pi*"<<pow(r,2)+sqrt(pow(r,2)+pow(h,2))<<endl;
  9. cout<<"Volume of the cone = pi*"<<h*pow(r,2)/3<<endl;
  10. }
Success #stdin #stdout 0s 4548KB
stdin
3 4
stdout
surface area of the cone = pi*14
Volume of the cone = pi*12