Saturday, 22 August 2015

Write a C Program To Check Even And Odd Number

#include<stdio.h>
#include<conio.h>

int main()
{
            int n;   // declare integer type variable
            clrscr();

            printf("\n Enter the number : ");
            scanf("%d",&n);

            if(n%2==0)  // check the condition whether the modulo is zero or not
            {
                        printf("\n Entered number %d is EVEN",n);
            }
            else      //   otherwise this part will be executes
            {
                        printf("\n Entered number %d is ODD",n);
            }

            getch();

            return 0;

}

No comments:

Post a Comment