Wednesday, 19 February 2014

Write a C program to determine whether a number is even or odd.

#include<stdio.h>
main()
{   
    int num;
    printf("\nEnter a number=");
    scanf("%d",&num);
    if(num%2==0)
        printf("\n%d is an even number");
    else   
        printf("\n%d is an odd number");
}

No comments:

Post a Comment