Calculate volume and surface area of a cone | CPP program to calculate Volume and Surface area of Cone ; Function to calculate Volume of cone ; Function to calculate Surface area of cone ; Driver Code ; Printing value of volume and surface area
#include <iostream> NEW_LINE using namespace std ; float pi = 3.14159 ; float volume ( float r , float h ) { return ( float ( 1 ) / float ( 3 ) ) * pi * r * r * h ; } float surface_area ( float r , float s ) { return pi * r * s + pi * r * r ; } int main ( ) { float radius = 5 ; float slant_height = 13 ; float height = 12 ; float vol , sur_area ; cout << " Volume ▁ Of ▁ Cone ▁ : ▁ " << volume ( radius , height ) << endl ; cout << " Surface ▁ Area ▁ Of ▁ Cone ▁ : ▁ " << surface_area ( radius , slant_height ) ; return 0 ; }