Hello everybody! I have a little problem in a piece of code that seems quite simple. This piece of code reads float numbers till the user hits the number -999.9. When he/she does then the program ends. So i write
float n;
scanf("%d", &n);
while (n != -999.9) {
i++;
scanf("%d", &n);
}
The problem is that when i hit simply -999 the piece of code works. But when i hit -999.9 then it doesn't work. I think it's the decimal part that causes the problem but i can't imagine why...Any idea will be appreciated. Thank you in advance for spending your time with me.