summary refs log tree commit diff stats
path: root/c/leap/src
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2021-08-27 09:47:13 +0530
committerAndinus <andinus@nand.sh>2021-08-27 09:47:13 +0530
commit4607171bb302ba81229ed5686d7c6f546d27a33d (patch)
treea511fed23a62fca764f2bcce3a28747441aaef09 /c/leap/src
parent346da9a7e08af19141a791978b3650bb150eafb0 (diff)
downloadexercism-4607171bb302ba81229ed5686d7c6f546d27a33d.tar.gz
C: Solve leap exercise
Diffstat (limited to 'c/leap/src')
-rw-r--r--c/leap/src/leap.c5
-rw-r--r--c/leap/src/leap.h8
2 files changed, 13 insertions, 0 deletions
diff --git a/c/leap/src/leap.c b/c/leap/src/leap.c
new file mode 100644
index 0000000..dc99a10
--- /dev/null
+++ b/c/leap/src/leap.c
@@ -0,0 +1,5 @@
+#include "leap.h"
+
+bool leap_year(int year) {
+    return !(year % 4) && (year % 100 || !(year % 400));
+}
diff --git a/c/leap/src/leap.h b/c/leap/src/leap.h
new file mode 100644
index 0000000..6750a54
--- /dev/null
+++ b/c/leap/src/leap.h
@@ -0,0 +1,8 @@
+#ifndef LEAP_H
+#define LEAP_H
+
+#include <stdbool.h>
+
+bool leap_year(int year);
+
+#endif