WRITE A JAVA PROGRAM THAT ACCEPTS FOUR INTEGER FROM THE USER AND PRINTS EQUAL IF ALL FOUR ARE EQUAL, AND NOT EQAL OTHERWISE.
INPUT:-
import java.util.Scanner;
public class example{
public static void main(String args[]){
int num1,num2,num3,num4;
Scanner sc= new Scanner(System.in);
System.out.println("Enter first number : ");
num1=sc.nextInt();
System.out.println("Enter second number : ");
num2=sc.nextInt();
System.out.println("Enter third number : ");
num3=sc.nextInt();
System.out.println("Enter fourth number : ");
num4=sc.nextInt();
if(num1==num2 && num2==num3 && num3==num4 && num4==num1)
{
System.out.println("All numbers are equal ");
}
else
{
System.out.println("All numbers are not equal ");
}
}
}
0 Comments