C program to check a number is even

C Programming Language / Decision Making of C Language

1291

Program:

#include"stdio.h"
int main()
{
    int number;

    printf("Enter an integer: ");
    scanf("%d", &number);

    // True if the number is perfectly divisible by 2
    if(number % 2 == 0)
       {
        printf("%d is even. \n", number);
       }
    
}

Output:

Enter an integer: 12
12 is even.
Press any key to continue . . .

Explanation:

In this c program you have learned that, how to check a number is even or not.


This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.