write a Java Program which displays perimeter of a square and rectangle
Answers
Answered by
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
Social Sciences,
4 months ago
Math,
8 months ago
English,
8 months ago
English,
10 months ago
English,
10 months ago