Originally Posted by
IxTanGxI
I did not think indention would make a difference when it runs. I tried it anyways and it did not work.
It doesn't make a difference.
However, when you post code, the indentation usually tells us what you intend to be happening. In your case:
Code:
if (year%8 == 0 && year%32 != 0){
if(year%2 == 1)
printf("\n%d is a leap year", year);
}
else
printf("\n%d is not a leap year", year);
Because of where you've put the closing brace } it makes the else bound to the if (year%8... and NOT the if (year%2 which is what your intentation appears to suggest. So, with correct indentation (but the same code), it would look like as per tretton's first post.
If you actually want to do what your indentation suggests, it should be instead:
Code:
if (year%8 == 0 && year%32 != 0) {
if (year % 2 == 1)
printf("\n%d is a leap year", year);
else
printf("\n%d is not a leap year", year);
}