Home
User Guide
DB Recovery
Download
Documents
FAQ
Books
About Me
C Programs
Stats

/* Program# 22
   date : 25-12-2008
   Even number or not 
*/

#include <stdio.h>
main(){
int n,x;
printf("\nEnter a integer :");
scanf("%d",&n);
x=n%2;
if(x) 
printf("\n%d : Not an Even number\n",n);
else
printf("\n%d : Even number\n",n);
}
output:
Enter a integer : 13
13 : Not an Even number


Things to note:  Here the value 1 is considered as true and value 0 as false.


Syntax for implicit if
if(true)
    do this;
else
    do this;

Powered by
Open Source Programmers