Computer Science, asked by SamprityPatra, 8 months ago

Write a java program to input the length and breadth of a triangle?​

Answers

Answered by sritijha67
1

Answer:

Java Program to Create a Simple Class to Find out the Area and Perimeter of Rectangle

« PrevNext »

This is a Java Program to Create a Simple Class to Find out the Area and Perimeter of Rectangle.

Formula:

Perimeter of rectangle = 2 * (length + breadth)

Area of rectangle = length * breadth

Enter the length and breadth of the rectangle as input. Now we use the given formula to calculate the area and perimeter of rectangle.

Here is the source code of the Java Program to Create a Simple Class to Find out the Area and Perimeter of Rectangle. The Java program is successfully compiled and run on a Windows system. The program output is also shown below.

import java.util.Scanner;

public class Area_Perimeter

{

public static void main(String[] args)

{

int l, b, perimeter, area;

Scanner s = new Scanner(System.in);

System.out.print("Enter length of rectangle:");

l = s.nextInt();

System.out.print("Enter breadth of rectangle:");

b = s.nextInt();

perimeter = 2 * (l + b);

System.out.println("Perimeter of rectangle:"+perimeter);

area = l * b;

System.out.println("Area of rectangle:"+area);

}

}

Explanation:

mark be brilliant plz ❤❤❤♥♥♥

Similar questions