Even or odd number C program

It’s an even or odd number C program that inputs any number from the user, then check number is even or odd, and print result on the screen.

To understand this program, it’s better you should know the following topics:

Program (1): to check number is even or odd.

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

Output (1)

Enter a number : 23
number 23 is odd

Published by

Electrical Workbook

We provide tutoring in Electrical Engineering.

Leave a Reply

Your email address will not be published. Required fields are marked *