Computer Science, asked by jerinshoba81, 2 months ago

Write a program to calculate the area and perimeter of a square.
(Area = s*s) (Perimeter=4*s)​

Answers

Answered by kamalrajatjoshi94
0

Answer:

Program:-

import java.io.*;

public class Square

{

public static void main(String args[ ])throws IOException

{

InputStreamReader read=new InputStreamReader (System.in);

BufferedReader in=new BufferedReader(read);

int s,pr=0,ar=0;

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

s=Integer.parseInt(in.readLine());

pr=4*s;

ar=s*s;

System.out.println("The perimeter of square="+pr);

System.out.println("The area of square="+ar);

}

}

Similar questions