ccplusplus.com
Learn C, C++ Concepts
Tuesday, February 21, 2012
c program to check odd or even
/************************************************************************* * File : check-even-odd.c * Author : Saurabh Gupta * Desc : c program to check odd or even * Source : http://ccplusplus.com/p/c.html * Created : 8:02 PM Tuesday, February 21, 2012 *************************************************************************/ #include
void main() { int n; printf("Enter any Number\t: "); scanf("%d",&n); if (n%2==0) { printf("\nThe number is even\n"); } else { printf("\nThe number is odd\n"); } } /* * OUTPUT * [sgupta@rhel6x86 c]$ gcc check-even-odd.c -o check-even-odd [sgupta@rhel6x86 c]$ ./check-even-odd Enter any Number : 10 The number is even [sgupta@rhel6x86 c]$ ./check-even-odd Enter any Number : 7 The number is odd [sgupta@rhel6x86 c]$ */
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment