What is the output of the following java code assume all


What is the output of the following Java code (Assume all variables are properly declared and the input is 3 7 4 -1 [Note: four inputs]).

num = console.nextInt();

sum = num;

while (num != -1)

{

             num = console.nextInt();

             sum = sum + num;

}

System.out.println(sum);

Solution Preview :

Prepared by a verified Expert
Business Management: What is the output of the following java code assume all
Reference No:- TGS02682220

Now Priced at $10 (50% Discount)

Recommended (98%)

Rated (4.3/5)