Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package prelimactivities.laboratoryActivity_5;
- import java.util.Scanner;
- public class RelationalOperators {
- public static void main(String[] args) {
- // Create a Scanner
- Scanner input = new Scanner(System.in);
- //Prompt the user to enter a number.
- System.out.println("Enter your number: ");
- int operand1 = input.nextInt();
- int operand2 = input.nextInt();
- int operand3 = input.nextInt();
- int operand4 = input.nextInt();
- int operand5 = input.nextInt();
- int operand6 = input.nextInt();
- int operand7 = input.nextInt();
- int operand8 = input.nextInt();
- int operand9 = input.nextInt();
- int operand10 = input.nextInt();
- int operand11 = input.nextInt();
- int operand12 = input.nextInt();
- input.close();
- //Display the relationship of the operand 1 and operand 2
- System.out.println("\n");
- if (operand1 == operand2)
- System.out.println("1st number and 2nd number are equal.");
- if (operand1 >= operand2)
- System.out.println("1st number is greater than or equal to 2nd number.");
- if(operand1 <= operand2)
- System.out.println("1st number is less than or equal to 2nd number.");
- if(operand1 > operand2)
- System.out.println("1st number is greater than to 2nd number.");
- if(operand1 < operand2)
- System.out.println("1st number is less than to 2nd number.");
- if (operand1 != operand2)
- System.out.println("1st number and 2nd number are not equal.");
- //Display the relationship of the operand 3 and operand 4
- if (operand3 == operand4)
- System.out.printf("\n3rd number and 4th number are equal.");
- if (operand3 >= operand4)
- System.out.printf("\n3rd number is greater than or equal to 4th number.");
- if(operand3 <= operand4)
- System.out.printf("\n3rd number is less than or equal to 4th number.");
- if(operand3 > operand4)
- System.out.printf("\n3rd number is greater than to 4th number.");
- if(operand3 < operand4)
- System.out.printf("\n3rd number is less than to 4th number.");
- if (operand3 != operand4)
- System.out.printf("\n3rd number and 4th number are not equal.");
- System.out.println("\n");
- //Display the relationship of the operand 5 and operand 6
- if (operand5 == operand6)
- System.out.printf("\n5th number and 6th number are equal.");
- if (operand5 >= operand6)
- System.out.printf("\n5th number is greater than or equal to 6th number.");
- if(operand5 <= operand6)
- System.out.printf("\n5th number is less than or equal to 6th number.");
- if(operand5 > operand6)
- System.out.printf("\n5th number is greater than to 6th number.");
- if(operand5 < operand6)
- System.out.printf("\n5th number is less than to 6th number.");
- if (operand5 != operand6)
- System.out.printf("\n5th number and 6th number are not equal.");
- System.out.println("\n");
- //Display the relationship of the operand 7 and operand 8
- if (operand7 == operand8)
- System.out.printf("\n7th number and 8th number are equal.");
- if (operand7 >= operand8)
- System.out.printf("\n7th number is greater than or equal to 8th number.");
- if(operand7 <= operand8)
- System.out.printf("\n7th number is less than or equal to 8th number.");
- if(operand7 > operand8)
- System.out.printf("\n7th number is greater than to 8th number.");
- if(operand7 < operand8)
- System.out.printf("\n7th number is less than to 8th number.");
- if (operand7 != operand8)
- System.out.printf("\n7th number and 8th number are not equal.");
- System.out.println("\n");
- //Display the relationship of the operand 9 and operand 10
- if (operand9 == operand10)
- System.out.printf("\n9th number and 10th number are equal.");
- if (operand9 >= operand10)
- System.out.printf("\n9th number is greater than or equal to 10th number.");
- if(operand9 <= operand10)
- System.out.printf("\n9th number is less than or equal to 10th number.");
- if(operand9 > operand10)
- System.out.printf("\n9th number is greater than to 10th number.");
- if(operand9 < operand10)
- System.out.printf("\n9th number is less than to 10th number.");
- if (operand9 != operand10)
- System.out.printf("\n9th number and 10th number are not equal.");
- System.out.println("\n");
- //Display the relationship of the operand 11 and operand 12
- if (operand11 == operand12)
- System.out.printf("\n11th number and 12th number are equal.");
- if (operand11 >= operand12)
- System.out.printf("\n11th number is greater than or equal to 12th number.");
- if(operand11 <= operand12)
- System.out.printf("\n11th number is less than or equal to 12th number.");
- if(operand11 > operand12)
- System.out.printf("\n11th number is greater than to 12th number.");
- if(operand11 < operand12)
- System.out.printf("\n11th number is less than to 12th number.");
- if (operand11 != operand12)
- System.out.printf("\n11th number and 12th number are not equal.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement