Program #2
Write a program in Java to implement the formula:
Area = Length * Width * Height
import java.util.Scanner;
public class implementingFormula {
public static void main(String [ ] args)
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter the Length: ");
double length = sc.nextDouble();
System.out.println("Enter the Width: ");
double width = sc.nextDouble();
System.out.println("Enter the Height: ");
double height = sc.nextDouble();
double area = length * width * height;
System.out.println("The Area is : " +area);
sc.close();
}
}
Output:
Enter the Length: 2
Enter the Width: 2
Enter the Height: 4
The Area is : 16.0
Post a Comment
0Comments