Given the dimensions of the cone, find the Surface area and Volume of a cone. The formula’s to calculate the area and volume are given below.
Cone is a three-dimensional geometric shape. It consists of a base having the shape of a circle and a curved side (the lateral surface) ending up in a tip called the apex or vertex.
Surface Area of Cone = Area of cone + Area of Circle = pi * r * s + pi * r^2
Volume of Cone = 1/3(pi * r * r * h)
where r is the radius of the circular base, h is the height (the perpendicular distance from the base to the vertex) and s is the slant height of the cone.
Slant height (s) can be calculated using Pythagoras formula sqrt(r * r + h * h)
Input : radius = 5 slant_height = 13 height = 12 Output : Volume Of Cone = 314.159 Surface Area Of Cone = 282.743 Input : radius = 6 slant_height = 10 height = 8 Output : Volume Of Cone = 301.593 Surface Area Of Cone = 301.593
- Given the dimensions of the cone, say radius R and height H of cone
- Find S = sqrt(R * R + H * H)
- Apply the above formulas
Surface area of cone is : 301.59289474462014 Volume of cone is : 301.59289474462014
Surface area of cone is : 170.81027853689216 Volume of cone is : 146.98129725379061
Time Complexity = O(1)
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.