5) Write a program in java to input two numbers and find the Greater Number using if else.
import java.util.*;public class Greater_using_if_else{public static void main(String args[ ]){Scanner sc = new Scanner (System.in);System.out.println("Enter two numbers");int a = sc.nextInt();int b = sc.nextInt();if(a>b){System.out.println("Greater number = "+a);}else{System.out.println("Greater number = "+b);}}}
No comments:
Post a Comment
if you have any doubts, Please let me know.
Your Truly
Shashank Porwal