Your Ad Here

Tuesday, January 22, 2008

Even / Odd Number

/* C Program For Checking whether a number is even or odd */

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

void main()
{
int a;
clrscr();
printf("Enter A number : ");
scanf("%d",&a);
if(a%2 != 0)
{
printf("\nThe Number %d Is Odd",a);
}
else if(a%2 == 0)
{
printf("\nThe Number %d Is Even",a);
}
getch();
}
/******************* OUTPUT ********************

Enter A number : 66
The Number 66 Is Even

Enter A number : 37
The Number 37 Is Odd */

22 comments:

Unknown said...

Great job
its really helps us a lot
thank you very much

cheyenne said...

wow.. thanks to this! =]]

chris said...

what about

if((num & 0x01))
{
cout << "odd";
}
else
{
cout << "even";
}

Unknown said...

thanks for this program

Ahad Baksh said...

thanks

Anonymous said...

thankx

Anonymous said...

#include
#include
void main()
{ clrscr() ;
int subject,topic;
printf("enter the number to find odd or even\n");
scanf("%d",&topic);
if (topic%2==0)
{
printf("the number is even%d\n",topic);
}
else
{ printf("the number is odd%d\n",topic);
}





getch();
}




sohail hussain pakistan 2010

Anonymous said...

#include

int main()
{
int a;

printf("Enter Your number that you want to check?");
scanf("%d",&a);
if(a%2==0)
{
printf("The Number Is %d Even\n",a);
}
else
{
printf("The Number %d Is Odd\n",a);
}

}

Anonymous said...

Man I need Explanation
Plzz Help me
whats this %2==0
exactly means
Response somebody plz

Anonymous said...

Man I need Explanation
Plzz Help me
whats this %2==0
exactly means
Response somebody plz

Anonymous said...

@Anonymous
it means when u divide any integer with 2, the remainder should be 0 if its an even number...

Anonymous said...

thanks for that! I've been wondering what modulo means...

prabhakar said...

thankss a lot...!

Anonymous said...

These codes not get works on numbers having 12 digit numbers.... Please help..

ani said...

Agorithm please for this program

Anonymous said...

Great site you have here but I was wanting to know if you knew of any forums that cover the same
topics talked about in this article? I'd really love to be a part of online community where I can get suggestions from other knowledgeable people that share the same interest. If you have any recommendations, please let me know. Bless you!

my blog visit this site

Anonymous said...

Wow, superb blog layout! How long have you been blogging for?
you make blogging look easy. The overall look of your site is great, as well as the content!


Feel free to visit my weblog: inquiry

Anonymous said...

Ahaa, its nice discussion about this article here at this webpage, I have read all that,
so now me also commenting here.

Visit my web blog pure green coffee bean dr oz

Anonymous said...

Ηowdy! I could have sworn I've been to this blog before but after browsing through a few of the posts I realized it's new tо mе.
Regardlеsѕ, I'm certainly pleased I came across it and I'll be bookmarkіng it and checkіng back oftеn!


My web blοg ... cheap party pills

RAJU said...

punda

RAJU said...

omment moderation has been enabled. All comments must be approved by the blog author.

Anonymous said...

gooood job
but how i can do same program with switch statement

Your Ad Here