Determining the highest and lowest number
<p>I'm currently writing a program where the user must input 10 numbers and then the output will be the highest number and the lowest number. There is something wrong in my code but couldn't find it. Here is my code:</p>

<pre><code>   int highest=0, lowest=0, num=0;
    Scanner scan = new Scanner(System.in);


    for(int i=0; i&lt;10; i++){

       System.out.print("Enter a number:");
       num = scan.nextInt();
    }

       if (num &gt; highest){

        highest = num;
       }

       else if(num &lt; lowest){

        lowest = num;
       }

       System.out.println("Highest number is: " + highest);
       System.out.println("Lowest number is: " + lowest);
</code></pre>
