Blog Moved

This website completely moved to new domain. For latest content, visit

Search This Blog

24 Jul 2012

c program to find the number even or odd

c program to find whether the given number is even or odd..

#include <stdio.h>
void main()
    int num;

     printf("Enter a number to find Even or Odd: \n");
     scanf("%d",&num);  /* taking input from user*/

    if (num%2==0) /*checking whether the remainder is zero when divided by 2*/
        printf(" The number %d is Even",num);
        printf(" The number %d is Odd",num);


Sample Output:  (using GNU GCC Compiler with Code Blocks IDE)
Enter a number to find Even or Odd: 5
The number 5 is Odd

No comments:

Post a Comment