sample code is here, desire output is 2
::
#include <stdio.h>
int main()
{
double i, a, b;
int j;
for (i = 0; i <= 3; i = i + .20)
{
if (i == 2)
{
printf("I=%lf\n", i);
}
}
}
When I use
#include <stdio.h> int main() { double i, a, b; int j; for (i = 0; i <= 3; i = i + .25) { if (i == 2) { printf("I=%lf\n", i); } } }
it works; but in the first case, it is not working. WHY ??