Tuesday, March 1, 2016

Even or odd define by C programming

You can easily test a number even or odd by C Program. See this:

#include<stdio.h>

int main()
{
    int num;
    printf("Enter a Number: ");
    scanf("%d",&num);
    if(num%2==0)
    {
        printf("This is a even number");
    }
    else
    {
        printf("This is a odd number");

    }
    return 0;
}

No comments:

Post a Comment