Math, asked by ttasken6, 6 months ago

Write a program to input the length ànd breadth in whole numbers print area of rectangle

Answers

Answered by Anonymous
15

 \huge{ \blue{Question :  - }}

Write a program to input the length ànd breadth in whole numbers print area of rectangle

 \huge{ \red{Solution :  - }}

User would provide the length and width values during execution of the program and the area would be calculated based on the provided values.

__________________________________

import java.util.Scanner;

class AreaOfRectangle {

public static void main (String[] args)

{

Scanner scanner = new Scanner(System.in);

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

double length = scanner.nextDouble();

System.out.println("Enter the width of Rectangle:");

double width = scanner.nextDouble();

//Area = length*width;

double area = length*width;

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

}

}

___________________________________

 \huge{ \green{Output :  - }}

Enter the length of Rectangle:

2

Enter the width of Rectangle:

8

Area of Rectangle is:16.0

Similar questions