Computer Science, asked by shree102, 8 months ago

write a Java Program which displays perimeter of a square and rectangle​

Answers

Answered by shanvi83
0

Answer:

import java.util.*;

class perimeter {

public static void main(String args[]){

Scanner sc= new Scanner(System.in);

System.out.println(" enter the length and breadth of the rectangle->");

int l= sc.nextInt();

int b= sc.nextInt();

int pr= 2(l*b);

System.out.println(" Enter the side of the square->");

int a= sc.nextInt();

int ps= 4* a;

System.out.println(" The perimeter of the rectangle is="+pr);

System.out.println(" The perimeter of the square is=+ps);

}

}

hope it helps........

Similar questions