Write a program to calculate the area and perimeter of a square.
(Area = s*s) (Perimeter=4*s)
Answers
Answered by
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
Art,
1 month ago
English,
1 month ago
Political Science,
2 months ago
Math,
2 months ago
Math,
9 months ago
Social Sciences,
9 months ago
Hindi,
9 months ago