Programming Shortcut

Write, Run and execute Your programs with simple and esay way by Programming Shortcut

Monday, February 4, 2019

Relation of two numbers in java

Hello friends! Welcome to my website.
 Java programming to find the two number how to related to each other is greater than or less than or equal? This java language programming is free all type of errors like compiler and runtime errors and this programming is tested to compile and then run the program code.
Here is only programming code only with their output.

Find the relation of two numbers java programming language.


     //----Code Start----
     import java.util.*;

    class test2 { //test class
        int a, b;
        // class object
        public void relate_number(int a, int b) {
            if (a < b) {    //frist condtion
                System.out.println(a + " is less than " + b);
           }
            if (a <= b) {   //second codtion
                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-----


      Output:  Please Enter the Frist Number: 5
                    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!

About Programming Shortcut

This is a programming learning website that can help you learn and when your write your programming code. And all programming code is compiled run programming code in the following programming language C, c++, Java, php and Javascript Languages. find your programming read, understand the programming then copy and past and run your program and save your golden time to typing the program becuse you learn more in leas time. All Programming is codeing is ease to understand the programming