Program to check given number is odd or even

0
4

 

#include<stdio.h>
#include<conio.h>
void main()
{
   int a;   /* for any integer */
   clrscr();
   printf("Enter a number \n");
   scanf("%d", &a);
   if(a%2==0)    /* checks for remainder is zero or not for 
                      even number it should be 0 */
     printf("%d is even number \n", a);
   else
     printf("%d is odd number \n", a);
getch();
}
    Output1:-
    Enter a number
    20
    20 is even number
    Output2:-
    Enter a number
    15
    15 is odd number   

 

 

 

program to check given number is odd or even program to check given number is odd or even in c program to check even or odd program to check whether a number is odd or even program to check whether a number is odd or even in c program to check if number is odd or even c program to check given number is odd or even

LEAVE A REPLY

Please enter your comment!
Please enter your name here