Problem on calculating a number

Hello, I met a problem in FreeFEM++ on calculating a integer number, which can be simplified as the following problem. I defined a integer M in the following two ways, and I expected that they give me the same number 2. However, I got M1 = 1 and M2 = 2 from the output. Why would this occur? Can anyone help me with this problem? Thanks!

int M1 = 20*(1.0-0.9);
int M2 = 20*0.1;
cout << "M1: " << M1 << ", M2: " << M2 << endl;