lundi 29 juin 2015

I wonder whats happens when if(i%2) what does it checks to come to continue. It misses == but it prints out the sum as 20? Why?

#import <stdio.h>
int main(void)
{
int sum,i;
sum = 0;
for(i=0;i<10;i++){
    if(i%2)
    continue;
    sum+=i;
}
printf("\n%d",sum);
return 0;
}

How does if(i%2) works in the above code?

Aucun commentaire:

Enregistrer un commentaire