Computer Science, asked by safinabls, 9 months ago

WAP TO ACCEPT LENGTH BREADTH AND HEIGHT OF A CUBOID AND DISPLAY ITS VOLUME AND TOTAL SURFACE AREA​

Answers

Answered by ItzMeSam35
2

Hello There

The Program is Java

//Integer Data Type :

import java.util.*;

public class Cuboid

{

public static void main(String args[])

{

Scanner sc = new Scanner (System.in);

System.out.println("Please Enter The Length Of The Cuboid");

int Length = sc.nextInt();

System.out.println("Please Enter The Breadth Of The Cuboid");

int Breadth = sc.nextInt();

System.out.println("Please Enter The Height Of The Cuboid");

int Height = sc.nextInt();

int Volume = Length * Breadth * Height ;

System.out.println("Volume Of The Cuboid = "+Volume);

int Area = Length * Breadth ;

System.out.println("Surface Area Of The Cuboid = "+Area);

sc.close();

}

}

____________________________________________

//Double Data Type :

import java.util.*;

public class Cuboid

{

public static void main(String args[])

{

Scanner sc = new Scanner (System.in);

System.out.println("Please Enter The Length Of The Cuboid");

double Length = sc.nextDouble();

System.out.println("Please Enter The Breadth Of The Cuboid");

double Breadth = sc.nextDouble();

System.out.println("Please Enter The Height Of The Cuboid");

double Height = sc.nextDouble();

double Volume = Length * Breadth * Height ;

System.out.println("Volume Of The Cuboid = "+Volume);

double Area = Length * Breadth ;

System.out.println("Surface Area Of The Cuboid = "+Area);

sc.close();

}

}

Attachments:
Similar questions