write a program in Java to find area,perimeter and diagonal of square
Answers
Answered by
30
Hey There!!
Here's your code:
import java.util.Scanner;
public class Square
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.print("Enter length of side of square: ");
double l = sc.nextDouble();
System.out.println("\nArea of square = "+(l*l));
System.out.println("Perimeter of square = "+(4*l));
System.out.println("Length of Diagonal of square = "+(l*Math.sqrt(2)));
}
}
Hope it helps
Purva
Brainly Community
Here's your code:
import java.util.Scanner;
public class Square
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.print("Enter length of side of square: ");
double l = sc.nextDouble();
System.out.println("\nArea of square = "+(l*l));
System.out.println("Perimeter of square = "+(4*l));
System.out.println("Length of Diagonal of square = "+(l*Math.sqrt(2)));
}
}
Hope it helps
Purva
Brainly Community
Answered by
12
import java.util.Scanner;
public class Square
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.print("Enter length of side of square: ");
double l = sc.nextDouble();
System.out.println("\nArea of square = "+(l*l));
System.out.println("Perimeter of square = "+(4*l));
System.out.println("Length of Diagonal of square = "+(l*Math.sqrt(2)));
}
}
Similar questions