Computer Science, asked by cricketer009, 5 months ago

Q1: Write a program to accept the length and breadth of a rectangle from user and

calculate its area and perimeter. Display the length, breadth , calculated area and

perimeter on the screen​

Answers

Answered by arsalan18
2

Explanation:

by using Java air qbasic?

for qbasic:

CLS

INPUT "enter length of rectangle";L

INPUT "enter breadth of rectangle";B

A= L*B

P= 2*(L+B)

PRINT "Length is";L

PRINT "breadth is";B

PRINT " Area is";A

PRINT "Perimeter is";P

END

________________________________

java:

import java.util.*;

{

public static void main (string args[])

{

scanner x=new scanner (system.in);

system.out.println ("enter length and breadth of rectangle");

int l= x.next int ();

int b= x.next int ();

int a= l*b;

int p= 2*(l+b);

system.out.println ("length is"+l);

system.out.println ("breadth is"+b);

system.out.println ("area is"+a);

system.out.println ("perimeter is"+p);

}

}

Similar questions