wap to assign side=25 meter of square calculate and display it's area and it's perimeter in computer science java
Answers
Answered by
4
Question:-
- WAP to assign side=25 meter of square calculate and display it's area and it's perimeter.
Program:-
class Square
{
public static void main(String args[])
{
int s=25;
int p=4*s, a=s*s;
System.out.println("Perimeter of the square is: "+p+" metre.");
System.out.println("Area of the square is: "+a+" metre square.");
}
}
Answered by
1
Answer:
int s=25;
System. out. println("Area="+(Math.pow(s,2) +"\n Perimeter="+(4*s)) ;
#SmallestCodePossible
'\n' is used for leaving a line
Similar questions