Navigation

Friday, 27 February 2015

Check whether the number is even or odd

I am going to explain how to check whther the given number is even or odd. 

void main()
{
    int n;
    clrscr();
    printf("Program for testing whether the number is even or odd\n\n\n");
    printf("\t\t\tEnter number to test:");
    scanf("%d",&n);
    if(n%2==0)
        printf("Even number");
    else
        printf("Odd number");
    getch();
}

No comments:

Post a Comment