Like us on Facebook to get the latest links daily

Tuesday, December 20, 2011

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()
   int ival, remainder;


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

   remainder = ival % 2;

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



Enter an integer :13
13, is an odd integer

Enter an integer :24
24, is an even integer


Get E-mail Subscription for Latest Updates

Don't forget to Click on activation link , sent to your E-mail ID

No comments:

Post a Comment

You might also like:

Related Posts Plugin for WordPress, Blogger...