Computer Science, asked by snehaahirwar27, 1 month ago

write a program in Java to assign a side with a value and print the area of the square.​

Answers

Answered by SpandanMukherjee428
3

Answer:

import java.util.Scanner;

public class Main {

   

    public static void main(String[] args) {

         // Basic

         int side = 0;        // Length of side here

         System.out.println("Area of square is = " + side*side);

         

         // Advanced

         Scanner scanner = new Scanner(System.in);

         System.out.println("Dear user, please enter the length of one side

                                          of the square");

         side = scanner.nextInt();

         System.out.println("Area of square is = " + side*side);

    }

}

Similar questions