C Program to Check Whether a Given Positive Integer is Even or Odd

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

void main()
{
	 int num;
	 clrscr();
	 printf("Enter positive integer: ");
	 scanf("%d", &num);
	
	 if(num%2==0)
	 {
	  printf("%d is even.", num);
	 }
	 else
	 {
	  printf("%d is odd", num);
	 }
	 getch();
}

Output

Run 1:
--------------
Enter positive integer: 67 ↲
67 is odd

Run 2:
--------------
Enter positive integer: 86 ↲
86 is even

Leave a Reply

Your email address will not be published. Required fields are marked *

https://atozonlinesolutions.com/wp-content/uploads/2017/03/logo_white.png
https://atozonlinesolutions.com/wp-content/uploads/2017/03/logo_white.png
About
Products
Subscribe

If you wish to receive our latest news in your email box, just subscribe to our newsletter. We won’t spam you, we promise!

    Applauz

    As the pioneer of the lean startup movement, APPLAUZ has dedicated it’s time to sharing effective business strategies that help new businesses and enterpreneurs put their money to work in the right way.

    Subscribe

    If you wish to receive our latest news in your email box, just subscribe to our newsletter. We won’t spam you, we promise!

      Applauz

      As the pioneer of the lean startup movement, APPLAUZ has dedicated it’s time to sharing effective business strategies that help new businesses and enterpreneurs put their money to work in the right way.

      Copyright by BOLD THEMES. All rights reserved.