Sunday, 5 November 2017

java program that find maximum number



Problem 01:
Write a program that find the maximum number taking two number from user
Solution:
import java.util.*;
public class Message {
 public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int a,b;
    System.out.println("Enter two numbers");
    a=in.nextInt();
    b=in.nextInt();
    if(a>b)
        System.out.println("The maximum number is a= "+a);
    else
        System.out.println("The maximum number is b= "+b);
}
}

Output:
   


No comments:

Post a Comment