C program to check a number odd or even

/* Write a C program to check whether a given integer is odd or even*/ #include <stdio.h> #include <conio.h> void main() ...


/* Write a C program to check whether a given integer is odd or even*/

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

void main()
{
   int ival, remainder;

   clrscr();

   printf("Enter an integer :");
   scanf ("%d", &ival);

   remainder = ival % 2;

   if (remainder == 0)
printf ("%d, is an even integer\n", ival);
   else
printf ("%d, is an odd integer\n", ival);

}
/*-----------------------------
Output

RUN1

Enter an integer :13
13, is an odd integer

RUN2
Enter an integer :24
24, is an even integer

---------------------------------*/

Post a Comment

emo-but-icon

Search Here

Popular query

Follow Us

Ads By Google

Get free Update

Enter your email address:

E-mail verification is must for complete subscription

Delivered by FeedBurner

Circle AFS on Google Plus!

Follow AFS Google+ page
 

Side Ads

DMCA protected
Information, images and the content on this blog is Copyright ©AFS2011-2018. Please do not copy Any content for commercial purpose else we have to take a legal action. Thanks !!

Total Pageviews

Recent

free counters
 

Connect Us

Speech by ReadSpeaker

item