aboutsummaryrefslogtreecommitdiffstats
path: root/isOdd.c
diff options
context:
space:
mode:
authorEliteTK <tomasz.kramkowski@gmail.com>2014-02-24 21:03:53 +0000
committerEliteTK <tomasz.kramkowski@gmail.com>2014-02-24 21:03:53 +0000
commitbe9d9aedb53e9b3211765f16bf4b90f5d31c1722 (patch)
treef9368e8a880abf9b9392d631da1e5a373c23dc7e /isOdd.c
parentde4075f451a2d6e457dbf9dff714d166618c4495 (diff)
downloadc-stuff-be9d9aedb53e9b3211765f16bf4b90f5d31c1722.tar.gz
c-stuff-be9d9aedb53e9b3211765f16bf4b90f5d31c1722.tar.xz
c-stuff-be9d9aedb53e9b3211765f16bf4b90f5d31c1722.zip
Added all files
Diffstat (limited to 'isOdd.c')
-rw-r--r--isOdd.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/isOdd.c b/isOdd.c
new file mode 100644
index 0000000..c48c92c
--- /dev/null
+++ b/isOdd.c
@@ -0,0 +1,17 @@
+#include<stdio.h>
+
+_Bool isOdd( int );
+
+int main ( int argc, char *argv[] ) {
+ if ( argc == 2 ) {
+ printf("%s\n", isOdd( atoi( argv[1] ) ) ? "true" : "false" );
+ return 0;
+ } else {
+ printf("Usage: '%s <number>'\n", argv[0]);
+ return 1;
+ }
+}
+
+_Bool isOdd( int n ) {
+ return n % 2;
+}