java program to find the area and perimeter of a square when a diagonal is given
Home
/
Computer Science
/
java program to find the area and perimeter of a square when a diagonal is given
java program to find the area and perimeter of a square when a diagonal is given
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
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);
}
}