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 ); } } }
0 comments:
Post a Comment