C Language

June 9, 2023

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

program 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 : 444
444 is even

by : Ajaj Khan

Quick Summary:

program to use whether a number is even or odd in C language copy #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 : 444 444 […]