Computer Science, asked by velpulashreyansh07, 9 months ago

write a program to calculate volume of cube or cuboid or cylinder based on the choice in put by the user

Answers

Answered by BrainlyEmpire
14

Answer:

hello mate..

Explanation:

Import Java. until. Scanner;

class choice

{

public static void main()

{

System. out. println ("press 1 for cube\npress2 for cuboid");

Scanner SC = new Scanner(System.in);

int a=sc.nextInt();

switch(a)

{

case 1:

System. out. println ("Enter the length of cube");

int l=sc.nextInt();

System. out. println ("volume is "+(l*l*l));

break;

case 2:

System. out. println ("Enter the length,breadth and height");

int ll=sc.nextInt();

int b=sc.nextInt();

int h=sc.nextInt();

System. out. println ("volume is"+(ll*b*h));

break;

default:

System. out. println ("invalid choice ");

hope you get your answer

plz follow me follow back will be done

plz mark as brain list answer

Similar questions