Saturday, 27 December 2014

C Program to find a number is Even Or Odd


This is a basic program which checks whether the given number is even or odd.


PROGRAM :



#include <stdio.h>
#include <stdlib.h>
int main()
{
        int a;
        printf("Enter any number to check  Even Or Odd :  ");
        scanf("%d",&a);
        if(a%2 == 0)
            printf("%d is even",a);
        else
            printf("%d is odd",a);
        return 0;
}
OUTPUT :

C -  Even or Odd