write a program in Java to assign a side with a value and print the area of the square.
Answers
Answered by
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
Chemistry,
5 days ago
Math,
5 days ago
Computer Science,
5 days ago
Math,
11 days ago
English,
11 days ago
Business Studies,
8 months ago
Physics,
8 months ago