Javascript code to accept two positive or negative numbers and check whether they are equal or not
Answers
Answered by
0
Please answer give this question
Answered by
0
The java script code for the following problem statement is-
public static void main(String [] args)
{
int a,b;
Scanner sc= new Scanner(System.in);
System.out.print("Enter two numbers- ");
a= sc.nextInt();
b= sc.nextInt();
if(a==b)
{
System.out.print("The numbers are equal");
}
else
{
System.out.print("The numbers are not equal")
}
- The program takes two numbers from user as input and stores them in a and b.
- Then, the if-else construct checks whether they are equal or not and print statements accordingly.
Similar questions