Computer Science, asked by shahanabanu1999, 4 days ago

Write a Java program to find the area and perimeter of a square.Get inputs from the user

Attachments:

Answers

Answered by vaishnavipatel2209
0

Answer:

import java.util.Scanner;

public class Main

{

  public static void main(String[] args)

  {

     Scanner sc = new Scanner(System.in);

     System.out.println("Please enter side of square: ");

     double side = sc.nextDouble();

     double area = side * side;

     double perimeter=4*side;

     System.out.println("Area of square is: " + area);

     System.out.println("Perimeter of square is: " + perimeter);

     sc.close();

  }

}

Explanation:

Similar questions