C program to find Odd and Even Numbers.

 Q. Write a C program to find Odd and Even numbers.

Ans:

#include <stdio.h>


int main() {

    int num;

    

    printf("Enter a number: ");

    scanf("%d", &num);

    

    if(num % 2 == 0) {

        printf("%d is even.", num);

    } else {

        printf("%d is odd.", num);

    }

    

    return 0;

}




Comments