Write a program in Java to accept side length of a square. Find and print area
and perimeter of the square
Answers
Answered by
61
Explanation:
Program: calculate area & perimeter of a square in java
import java.util.Scanner;
public class AreaAndPerimeterOfSquare {
public static void main(String[] args) {
try (Scanner scanner = new Scanner(System.in)) { ...
double side = scanner.nextDouble();
//Area of square is side * side. ...
//Print area up to two precision.
Similar questions