26.Write a program to enter the perimeter of a square and find its area.
For Example,
INPUT:
Enter the perimeter of a square: 64
OUTPUT:
Area of the square is: 256
Answers
Answered by
3
Question:
Write a program to enter the perimeter of a square and find its perimeter.
Solution:
language used: Java
import java.util.*;
public class Question
{
static void main()
{
Scanner sc=new Scanner(System.in);
float p,s,a;
System.out.println("Enter the perimeter of a square:");
p=sc.nextInt();
s=p/4;
a=s*s;
System.out.println("Area of the square:"+a);
}
}
Similar questions