Showing posts with label odd. Show all posts
Showing posts with label odd. Show all posts

Wednesday, May 16, 2018

C program to check whether the given number is odd or even.


Program code
#include <stdio.h>
#include <conio.h>
void main()
{
int a;
clrscr();
printf("Please input a number to find whether it is odd or even.\n");
scanf("%d",&a);
if ((a%2)==0)
printf("%d is even.\n",a);
else
printf("%d is odd.\n",a);
getch();
}

Example of output
Please input a number to find whether it is odd or even.
700
700 is even.