.Write a program in java to input the length, breadth, and height of a cuboid and find its Volume and
Total Surface Area
Answers
Answer:
package com.tcc.java.programs;
import java.util.Scanner;
/**
* Java Program to find volume and surface area of Cuboid
*/
public class VolumeOfCuboid {
public static void main(String[] args) {
double length, width, height, volume, surfaceArea;
Scanner scanner;
scanner = new Scanner(System.in);
// Take input from user
System.out.println("Enter Length of Cuboid");
length = scanner.nextDouble();
System.out.println("Enter Width of Cuboid");
width = scanner.nextDouble();
System.out.println("Enter Height of Cuboid");
height = scanner.nextDouble();
/*
* Total surface area of Cuboid = 2x(lengthXwidth + widthXheight +
* heightXlength)
*/
surfaceArea = 2 * (length * width + width * height + height * length);
/* Volume of Cuboid = length*width*height */
volume = length * width * height;
System.out.format("Surface Area of Cuboid = %.3f\n", surfaceArea);
System.out.format("Volume of Cuboid = %.3f\n", volume);
}
}
Explanation:
i hope you like this plz follow me
Program: {JAVA}
import java.util.*;
public class Brainly
{
static void main()
{
Scanner sc=new Scanner(System.in);
float length,breadth,height,vol,area;
System.out.println("Enter length, breadth and height of a cuboid:");
length=sc.nextFloat();
breadth=sc.nextFloat();
height=sc.nextFloat();
vol=length*breadth*height;
area=2*(length*breadth+breadth*height+height*length);
System.out.println("Volume of cuboid="+vol);
System.out.println("Total Surface Area="+area);
}
}