Computer Science, asked by tarannumshahnaz1978, 11 months ago

input length and breadth of rectangle and calculate and display the area and perimeter of a rectangle in gw basic​

Answers

Answered by subham306952
0

Answer:

Program:

10    CLS

20     INPUT “Length …=”;L

30     INPUT  “Width …=”; W

40     PERIMETER=  2* ( L+W)

50     PRINT “ PERIMETER….. =”; PERIMETER

60     END

Algorithm

Step 1  START

Step 2  INPUT      L , W

Step 3  COMPUTE   PERIMETER = 2* ( L+W)

Step 4    PRINT   PERIMETER

Step 5  END

Answered by Anonymous
1

Answer:

import java.util.*;

public class Menu

{

public static void main {String args[] }

{

Scanner in = new Scanner (System.in)

int l, b , n, a , p;

double d;

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

a = in.nextInt();

b = in.nextInt();

System.out.println( "Enter 1 for area, 2 for perimeter, 3 for diagonal);

System.out.println("Enter your choice");

n = in.nextInt();

switch (n)

{

case 1:

a = l*b;

System.out.println("Area of rectangle =" +l);

break;

case 2:

p = 2(l+b);

System.out.println("Perimeter of rectangle =" +p);

break;

case 3;

d = Math.sqrt(l*l + b*b);

System.out.println("Diagonal of rectangle =" +d);

break;

default:

System.out.println(" wrong choice !!");

}

}

}

Similar questions