From fe22240e29d9bec6b675b05108aa4811dffabbc6 Mon Sep 17 00:00:00 2001 From: kevin Date: Sat, 2 Mar 2019 21:34:27 -0500 Subject: [PATCH] Add solution for problem 112 --- problem-112.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 problem-112.c diff --git a/problem-112.c b/problem-112.c new file mode 100644 index 0000000..79c1b4c --- /dev/null +++ b/problem-112.c @@ -0,0 +1,61 @@ +#include + +#define TRUE 1 +#define FALSE 0 + +int is_increasing(long num) +{ + int digit; + int prev = num % 10; + num /= 10; + + while (num>0) { + digit = num % 10; + if (digit>prev) + return FALSE; + num /= 10; + prev = digit; + } + return TRUE; +} + + +int is_decreasing(long num) +{ + int digit; + int prev = num % 10; + num /= 10; + + while (num>0) { + digit = num % 10; + if (digit