C Language

June 9, 2023

How to use whether a number is even or odd in C Language


#include <stdio.h>
void find(int n);
int main()
{
    int num;
    printf("Enter a number : ");
    scanf("%d", &num);
    find(num);
    return 0;
}
void find(int n)
{
    if (n % 2 == 0)
        printf("%d is even\n", n);
    else
        printf("%d is odd\n", n);
}

Output


Enter a Number : 12
12 is even

by : Nadeem Khan

Quick Summary: