prev Modular Division Operator 13. Even number or Odd number (25.6.2009) /* Program# 13 date : 25-12-2008 Even number or ODD number */ #include main(){ int n,x; printf("\nEnter a number : "); scanf("%d",&n); x=n%2; if(x==0) // even number is a number which is divisible by 2 printf("\n%d : Even number\n",n); else printf("\n%d : Odd number\n",n); } output: Enter a number : 35 35 : Odd number Things to note: 1.The sign of the remainder is always same as the sign of the numerator. 2. The modular division % operator returns the remainder on dividing one integer 35 with another integer. 3. It cannot be applied on float. 4. If the expression (x = = 0) evaluates to true means, the printf statement next to if will get printed, otherwise the statement after else will get printed. if - else statement if(condition) true statement; else false statement; If there are more than one statement, then it can be enclosed in curly braces { } if(condition) { statement 1; statement 2; . . statement n; } else { statement 1; statement 2; . . statement n; } next