Surface Area of Cone in Java || Geometric Program || Java Programming

In this program, we are going to Calculate the Surface Area of Cone in Java Programming Language.

Formula : - pi * radius * (radius + Slant-Height) / 4


// Surface Area of Cone

import java.util.*;

class Cone {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        float radius, slantHeight;
        double pi = 3.1428, area;

        System.out.print("Enter the Radius: ");
        radius = sc.nextFloat();
        System.out.print("Enter the Slant-Height: ");
        slantHeight = sc.nextFloat();

        area = pi * radius * (radius + slantHeight);

        System.out.print("The Surface Area of Cone with Radius " + radius);
        System.out.print("and Slant-Height " + slantHeight + " is " + area);
    }
}

#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post