Programming Shortcut

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

Monday, February 4, 2019

Find Bigger and Smaller number by Java Programming

Hello friends! Welcome to my website
Java programming to find the bigger and smaller number between two numbers?
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 with the output. This programming output is customized to understand easily.


Program to print the bigger and smaller number between two numbers in java


import java.util.Scanner;

class test3 {

    int a, b;

    public void bigger(int a, int b) {
        if (a > b) {
            System.out.println(a + " is bigger than " + b);
        } else {
            System.out.println(b + " is bigger than " + a);
        }
    }

    public void smaller(int a, int b) {
        if (a < b) {
            System.out.println(a + " is smaller than " + b);
        } else {
            System.out.println(b + " is smaller than " + a);
        }
    }
}

public class largest_smallest {

    public static void main(String args[]) {
        Scanner c = new Scanner(System.in);
        test3 o = new test3();
        System.out.print("Enter the Frist Number: ");
        o.a = c.nextInt();
        System.out.print("Enter the Second Number: ");
        o.b = c.nextInt();
        System.out.println("The Result of the Programming");
        System.out.println("-----------");
        o.bigger(o.a, o.b);
        System.out.println("-----------");
        o.smaller(o.a, o.b);
    }
}


Output
Enter the Frist Number: 45
Enter the Second Number: 54
The Result of the Programming
-----------
54 is bigger than 45
-----------
45 is smaller than 54


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.

Please share your experience about this post,
Thank You!

Programming Shortcut is collections in java best programs with example, best c programs with example and best c++ programs with example, best way to learn java, c and c++

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