Find Greater Number with if else conditions

In this problem we will learn how to use If Else conditions and their scope in Java Programming . User will enter two numbers, with using IF ELSE conditions the program will generate the output which is greater number between these two numbers.

Source Code

package com.ancodingpoint.www;
import java.util.Scanner;

public class conditions
 public static void main(String[] args)
 {
            Scanner input = new Scanner (System.in);
            int a,b =0;
            System.out.println(" Enter Your Number ");
            a = input.nextInt();
            System.out.println(" Enter Your Number ");
            b = input.nextInt();
            if (a==b)
            {
            System.out.println(a + " is Equal :" + b );
            }
            else
                
            if (a>b)
            {
                System.out.println(a + " Greater Then :" + b );
            }
            else
            {
                System.out.println(b + " Greater Then :" + a );
            }
        } }

Output of the Program

Java Programming



Share on Google Plus

About Asad

Asad Niazi is Software Engineer , Programmer, Web Developer and a young mentor of BloggersTown and PProgramming. Asad Love to writes about Technology, Programming, Blogging and make money online.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment