take values of length and breadth of a rectangle from user and check if it is square or not program in java
Answers
Answered by
33
Question:-
Write a program to take values of length and breadth of a rectangle and check if it is a square or not.
Code:-
import java.util.*;
class CheckIf
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
System.out.print("Enter the length: ");
double l=sc.nextDouble();
System.out.println("Enter the breadth: ");
double b=sc.nextDouble();
if(l==b)
System.out.println("Square...");
else
System.out.println("Not a Square...");
}
}
Similar questions
Computer Science,
3 months ago
Math,
3 months ago
Science,
6 months ago
Math,
11 months ago
History,
11 months ago