Write a program to calculate Area and perimeter of a rectangle.
[Length:50 Breadth:20 Area:100 Perimeter:140]
Plz need answer urgently!!!
Answers
Answer:
Java
import java.util.*;
public class calculate{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter length");
int length = in.nextInt();
System.out.println("Enter breadth");
int breadth = in. nextInt();
int area = length * breadth;
int perimeter = 2*(length + breadth);
System.out.println("Area = "+length);
System.out.println("Perimeter = "+breadth);
}
}
Python
length = int(input("Enter length : "))
breadth = int(input("Enter breadth : "))
area = length * breadth
perimeter = 2 * (length + breadth)
print("Area = ", length)
print("Perimeter = ", breadth)
I don't know in which language you wanted so I answered in java and python. Hope it helps...