for (a=4;a<=100;a++) a=a+1; }
{
if ((a%2!=0)&&(a%3!=0))
{
printf("%d\n",a);
}
This is because on writing a=a+1
, the if condition will be checked only when the value of a is a multiple of 2 (4, 6, 8, etc). In that case, the condition will become false and so nothing will be printed.
Here is a more detailed explanation.
First iteration of for loop (a=4).
Second iteration of for loop (a=6 because a++ increments value of a by 1)
and this goes on.
If you remove a=a+1
, the condition of if will be checked when the value of a is a natural number greater than 4 (4, 5, 6, 7, etc).