TO CHECK WHETHER A GIVEN NUMBER IS POSITIVE OR NEGATIVE, IF NUMBER IS POSITIVE CHECK WHETHER IT IS ODD OR EVEN

#include<stdio.h>
void main()
{
    int num;
    printf("Enter a number");
    scanf("%d",&num);
    if(num > 0)
    {
        printf("Number is +ve\n");
        if(num % 2 == 0)
            printf("Number is Even");
        else
            printf("Number is Odd");
    }
    else
        printf("Number is -ve");
}

0 comments: (+add yours?)

Post a Comment