Computer Science, asked by kbaljinder052, 6 months ago

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 anindyaadhikari13
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