Computer Science, asked by eniggmaaag, 5 months ago

Write a program to input two sides of a rectangle from the user and print its area and perimeter [Area = L x B, Perimeter = 2 (L + B)]

Answers

Answered by Rishu12421
6

Program :

l=float(input("Enter length of rectangle: "))

b=float(input("Enter width of rectangle: "))

print("Area of rectangle is" , l*b)

print("Perimeter of rectangle is" , 2*(l+b))

Answered by akbarshibbi
1

Answer:

Write a program in which programming language? If java then here is the answer:

Explanation:

import java.util.*;

class rectangle

{

public static void main()

{

Scanner sc = newScanner(System.in);

System.out.println("Enter length and breadth of a rectangle:");

double L,B,A,P;

L = sc.nextDouble();

B = sc.nextDouble();

A = L*B;

P = 2*(L + B);

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

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

}

}

Similar questions