Sunday, 15 March 2015

To find whether the given number is even or odd Using C

# include <stdio.h>
# include <conio.h>

void main()
{
int num ;
clrscr() ;
printf("Enter a number : ") ;
scanf("%d", &num) ;
if(num % 2 == 0)
printf("\nThe given number is even") ;
else
printf("\nThe given number is odd") ;
getch() ;
}

RUN 1 :
~~~~~~~
Enter a number : 10
The given number is even
RUN 2 :
~~~~~~~
Enter a number : 5
The given number is odd

No comments:

Post a Comment