aboutsummaryrefslogtreecommitdiffstats
path: root/isOdd.c
blob: a36836c769f7a6d3b7f6b0297f92e1b95b54ed57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Refer to isOddBetter.c for info.
#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;
}