Answer to Question #255178 in Java | JSP | JSF for Lol

Question #255178
Output The first line will contain a message prompt to input the first number. The second line will contain a message prompt to input the second number. The third line will contain a message prompt to input the third number. The last line will contain the largest among the three numbers.
1
Expert's answer
2021-10-22T16:44:19-0400
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int max = Integer.MIN_VALUE;
        System.out.println("First number:");
        max = Math.max(in.nextInt(), max);
        System.out.println("Second number:");
        max = Math.max(in.nextInt(), max);
        System.out.println("Third number:");
        max = Math.max(in.nextInt(), max);
        System.out.println("Largest: " + 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