/* title: Even || Odd author: aeriqusyairi date: 23Jan 2012 */ #include<stdio.h> int even(int); int main(){ int a = 0, b = 0; printf("Input an integer:"); scanf("%d", &a); b = even(a); if(b == 1) printf("%d is an even integer.\n", a); else printf("%d is not an even integer.\n", a); system("pause"); return 0; } int even(int number){ if(number % 2 == 0) return 1; else return 0; }
My C Repository
C How to Program
Sweet thanks to my broski Yusuke Fiz for this Deitel book.
You light up my life dude.
Just another personal public repository.
Thursday, March 15, 2012
Even or Odd
Inputs a series of integers and passes them one at a time to function even, which use the remainder operator to determine if an integer is even.The function return 1 if the ineteger is even and 0 otherwise.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment