write a program in java to accept the side of the square and to find its area and perimeter
Answers
Answered by
1
import java.util.Scanner;
public class Square
{
public static void main (String args[])
{
Scanner sc = new Scanner(System.in);
System.out.print("Please enter the side of the square : ");
double s = sc.nextDouble();
double p = 4*s;
double a = s*s;
System.out.println("Perimeter : "+p);
System.out.println("Area : "+a);
sc.close();
}
}
Similar questions