find minimum value using a for loop
<p>I am trying to take 10 integers from the user's input and find the minimum value using a <code>for</code> loop.</p>

<p>I am struggling to correctly write the <code>if</code> statement. It is supposed to take the first input and make that the smallest and compare the next inputs to that.</p>

<p>My final print statement just prints the last number entered.</p>

<pre><code>Scanner scan = new Scanner(System.in);

int smallest = 0;
int number = 0;

for (int i = 1; i &lt;= 10; i++) {
   System.out.print("Enter a number &gt; ");
   number = scan.nextInt();

   if (number &lt; smallest) {
       smallest = number; 
   } else {  
       smallest = number; 
   }       
}
System.out.println("The minimum is " + smallest);
</code></pre>