Q:

C Program to check whether number is EVEN or ODD using switch

0

C Program to check whether number is EVEN or ODD using switch

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <stdio.h>
 
int main()
{
    int number;
     
    printf("Enter a positive integer number: ");
    scanf("%d",&number);
     
    switch(number%2) 
    {
        case 0:
            printf("%d is an EVEN number.\n",number);
            break;
        case 1:
            printf("%d is an ODD number.\n",number);
            break;
    }
     
    return 0;
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now