aboutsummaryrefslogtreecommitdiffstats
path: root/isOdd.c
diff options
context:
space:
mode:
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;
+}