Answer to Question #255520 in Java | JSP | JSF for Bre

Question #255520
Write the java program that calculates maximum of the given two numbers.
1
Expert's answer
2021-10-23T08:06:04-0400
import java.util.Scanner;
public class Main
{
    public static void main(String args[])
    {
        System.out.println("Enter the first Number");
        Scanner scan = new Scanner(System.in);
        int i = scan.nextInt();
        System.out.println("Enter the second Number");
        int j = scan.nextInt();
        int max = i;
       if(j>i){
           max = j;
       }
       System.out.println("Maximum number is: "+max);
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS