0

Show the printout of the following code: Suppose the input is 2 3 4 5 0. What is the output of the following code?

import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner input = new Scanner(System.in); int number, max; number = input.nextInt(); max = number; while (number != 0) { number = input.nextInt(); if (number > max) max = number; } System.out.println("max is " + max); System.out.println("number " + number); }

24th Nov 2020, 12:48 PM
Zaina Fannana
2 Respuestas
+ 2
For the only output, you can find it in code playground...
24th Nov 2020, 12:53 PM
Jayakrishna 🇮🇳
+ 1
Try on Code playground. Then if you have any doubt ask here.
24th Nov 2020, 12:54 PM
Vadivelan