Here is only programming code only with their output.
Find the relation of two numbers java programming language.
import java.util.*;
class test2 { //test class
int a, b;
// class object
public void relate_number(int a, int b) {
if (a
System.out.println(a + ” is less than ” + b);
}
if (a
System.out.println(a + ” is lass than or equal to ” + b);
}
if (a == b) { //third condtion
System.out.println(a + ” equal to ” + b);
}
if (a >= b) { //fourth condtion
System.out.println(a + ” is greater than or equal to ” + b);
}
if (a > b) { //fivth condtion
System.out.println(a + ” is greater than to ” + b);
}
}
}
public class relation {
public static void main(String args[]) {
Scanner c = new Scanner(System.in);
//making object of the class test2
test2 o = new test2();
//input
System.out.print(“Please Enter the Frist Number: “);
o.a = c.nextInt();
System.out.print(“Please Enter the Second Number: “);
o.b = c.nextInt();
//output
System.out.println(“The Numbers are relate as Following: “);
o.relate_number(o.a, o.b);
}
}
//—-Code End—–
Please Enter the Second Number: 5
The Numbers are related as Following:
5 is less than or equal to 5
5 equal to 5
5 is greater than or equal to 5
I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any dought about this java programming code or input & output please comment below
If you have other question about java programming send an email by contacting us form are given on page right side.
Thank You!