Computer Science, asked by mdhanzala70, 1 month ago

Write a program in java to find and display the area and perimeter of a square, where side of a square is 10.​

Answers

Answered by Prettyboy1231
4

Answer:

Java Program Example - Calculate Area Perimeter of Rectangle */

import java.util.Scanner;

public class JavaProgram

{

public static void main(String args[])

{

int len, bre, peri, area;

Scanner scan = new Scanner(System.in);

System.out.print("Enter Length and Breadth of Rectangle : ");

len = scan.nextInt();

bre = scan.nextInt();

area = len*bre;

peri = (2*len) + (2*bre);

System.out.print("Area = " +area);

System.out.print("\nPerimeter = " +peri);

}

Answered by girlattitude610
1

As you can see, this is square of a side length of 25m. Thus, the perimeter of a square can be calculated as:

P = a + a + a + a = 4a.

So, the perimeter of this square is as follows:

P = 4a = 4 * 25 = 100m.

Thus, the multiple methods used to calculate the perimeter of a square in Java programming are as follows:

Similar questions