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

by Nideesh C on April 11, 2011 · 0 comments

in C Programming




/* 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

———————————*/

Not Satisfied ? Just search & get the result

Related Posts Plugin for WordPress, Blogger...
Be Sociable, Share!

Related posts:

  1. Sample – Program to enter an integer and find out if it is even or odd.
  2. Sample – Program to enter an integer and output the cube of that integer.
  3. Sample – Program to enter an integer and output its 15 multiples.
  4. Sample – Program to enter an integer and print out its successor.
  5. Sample – Program to enter an integer and output it in the reversed form.

Leave a Comment

Previous post:

Next post: