Hi, everyone. I am trying to use the code below to print the numbers 2, 2 + 0.1, 2 + 0.1 + 0.1, and so on, performing the loop 1000 times, but somehow the printing starts 72.6 and not 2, why?
Thanks in advance!Code:#include <stdio.h>
int main(void)
{
double number = 2.0;
int i;
for ( i = 1 ; i <= 1002 ; i++ )
{
printf("%f\n", number);
number = number + 0.1;
}
return 0;
}