Write a program in BlueJ to take values of length and breadth from user and check if it is square
or a rectangle.
Answers
Answered by
0
Answer:So I am assuming that you are using java IDE and the program should go like this:
Public class lenght_checker (whatever you want to name it I named it "length checker")
Public static void main(int side1, int side2)
{
If (side1==side2)
{
System.out.println("Its a square!");
}
else
{
System.out.println("It's a rectangle!");
}
}
Explanation:In this it first checks that weather both the values are equal or not, if the values are equal then it will be a square, if the length and breadth are of different value then it is a rectangle. There is a slight chance that there might be an error in the code because I'm still in ninth grade but hope this code helps to solve your problem .
Similar questions