java program to find the area and perimeter of a square when a diagonal is given
Answers
Answered by
1
import java.util.Scanner;
public class Demo
{
public static void main(String args[])
{
int a, s, c;
Scanner hello = new Scanner(System.in);
System.out.print("Enter Square Length :");
c = hello.nextInt();
a = c * c;
s = 4 * c;
System.out.print("\n Area of a square = " +a);
System.out.print("\n\n Perimeter of a square = " +s);
}
}
public class Demo
{
public static void main(String args[])
{
int a, s, c;
Scanner hello = new Scanner(System.in);
System.out.print("Enter Square Length :");
c = hello.nextInt();
a = c * c;
s = 4 * c;
System.out.print("\n Area of a square = " +a);
System.out.print("\n\n Perimeter of a square = " +s);
}
}
Similar questions