write a program in java to enter the dimensions of a cuboid and find its volume using the formula: [Volume of the cuboid = length×breadth×height]
Answers
Answered by
0
Answer :- using Scanner
import java.util.*;
public class Volume{
public static void main(String args[]){
Scanner scn=new Scanner(System.in);
System.out.print("Enter length : ");
double length=scn.nextDouble();
System.out.print("Enter width : " );
double breadth=scn.nextDouble();
System.out.print("Enter height : ");
double height=scn.nextDouble();
double volume=length*breadth*height;
System.out.println(" Volume : "+volume);
scn.close();
}
}
Answer :- without using Scanner
public class Volume{
public static void main(double length, double breadth, double height){
double volume=length*breadth*height;
System.out.println(" Volume : "+volume);
}
}
.
.
.
.
HOPE THIS HELPS YOU
Similar questions