Computer Science, asked by sc9665307, 1 day ago

write a program in java to accept the side of the square and to find its area and perimeter​

Answers

Answered by ItzMeSam35
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