C program to find whether the given number is even or odd

#include< stdio.h >
#include< conio.h >
void main ()
{
          int n, rem;
         clrscr();
         printf("Enter a number:");
         scanf("%d",&n);
         rem=n%2;
         if (rem==0)
        printf("The given number is Even ")
        else
        printf("The given number is Odd ");
        getch();
}

OUTPUT :

Enter a number :5
The given number is Odd

OR

OUTPUT :
Enter a number :4
The given number is Even

No comments :

Post a Comment