Computer Science, asked by aditi22307, 6 months ago

Write a program in Java to find the area, perimeter and the diagonal
of a square. Display the output of the program by taking side of a
square as 25​

Answers

Answered by xSahiBx
10

Answer:

__________________________________

import java.util.Scanner;

public class AreaAndPerimeterOfSquare {

public static void main(String[] args) {

// Taking inputs from user

Scanner sc = new Scanner(System.in);

System.out.print("Enter the Length: ");

double length = sc.nextDouble();

sc.close();

double area = length * length;

double perimeter = 4 * length;

double diagonal = Math.sqrt(2) * length;

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

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

System.out.println("Length of diagonal: " + diagonal);

}

}

__________________________________

Attachments:
Answered by Anonymous
2

\huge\mathcal{\fcolorbox{cyan}{black}{\pink{ᴀɴsᴡᴇʀ࿐}}}

hope It helps uh❤

Attachments:
Similar questions