2/21/2009

C Program To Check Whether The Given Number Is Odd or Even



    /*Write a c program to check whether
      the given number is odd or even */
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n ;
    printf("Enter number:\n");
        scanf("%d",&n);
    (n%2==0)? printf("%d is even number.\n", n): printf("%d is odd number.",n);
    return 0;
}
Out Put:
Enter number:
22
22 is even number.

No comments:

Post a Comment