Sunday, 24 August 2014

EVEN OR ODD

Q:- WRITE A PROGRAM TO CHECK WHETHER A GIVEN NUMBER IS EVEN OR ODD.

#include<conio.h>
#include<stdio.h>
void main ( )
{
int n,x;
char ch;
clrscr ( );
do
{
printf("\nEnter any Number\n");
scanf("%d",&n);
x=n%2;
if(x = = 0)
{
 printf("\n%d is Even ",n);
 }
else
{
 printf("\n%d is odd",n);
}
printf("\nPress Y to continue");
ch=getche();
}
while((ch=='y')||(ch=='Y'));
getch ( );
}

                                                                                by:-Danish Beigh
                                                                                Email Id:-- beigh.danish@gmail.com

No comments:

Post a Comment

Tell Us What You've Got...