I have a simple question in this code: 
 
#include <iostream>
using namespace std;
int main () {
int x, mn = 10000;
for (int i = 0 ; i<10 ; i++)
{
     cin>>x;
    if (x<mn)
        mn=x;
}
cout << mn;
return 0;
} 
Why this outputs the minimum although if cases are true if we consider that the user won't enter a number greater than 10000? 
 
My logic if the inputs are: in example 1, 2, 3, 4, 5, 6, 7, 8, 9, 10: 
 
1<mn 
okay now mn =1; 
2<mn 
okay now mn =2; 
........ and so on, til mn = 10;
Why doesn't it output 10 (the last value)? 
 I will be thankful if you help. 
 
PS: I also need a recommendation for better understanding how the code runs to me as a beginner.   
 
     
    