Yasir's Blog
Pages
About Me
C Programs
Java Programs
ML
Contact Me
Sitemap
Privacy Policy
Home
»
C Programs
»
C Program to find an Even or Odd Number
Saturday, 31 December 2016
C Program to find an Even or Odd Number
Program:
This program is saved as EvenOdd.c
#include
int main() { int n; printf("Enter an integer : "); scanf("%d",&n); /* if n is completely divisible by 2 then prints even otherwise n is odd */ if(n%2==0) printf("%d is an Even Number\n",n); else printf("%d is an Odd Number\n",n); return 0; }
Output:
Enter an integer : 17 17 is an Odd Number
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment