How do I determine the highest and lowest value in user-entered input?

后端 未结 4 1945
我寻月下人不归
我寻月下人不归 2020-12-11 14:43

I\'m trying to get the highest and lowest numbers entered by the user. The code below seems to be mostly working but I can\'t seem to get the right number for the lowest val

4条回答
  •  轮回少年
    2020-12-11 14:58

    What is the purpose of A? You're not modifying lowest either. You're close, try this:

    num = ...
    if ( num > max ) max = num;
    if ( num < min ) min = num;
    
    System.out.println("Highest: " + max);
    System.out.println("Lowest: " + min);
    

提交回复
热议问题