From 6e570c016b4f728504864652e2c725028fef2db1 Mon Sep 17 00:00:00 2001 From: Mohamed-Mehdi-Gara Date: Fri, 4 Jun 2021 19:45:08 +0100 Subject: [PATCH] added files --- Mehdi/Clock.c | 37 +++++++++++++++++++++++++++++++++++++ Mehdi/Contributing.md | 5 +++++ 2 files changed, 42 insertions(+) create mode 100644 Mehdi/Clock.c create mode 100644 Mehdi/Contributing.md diff --git a/Mehdi/Clock.c b/Mehdi/Clock.c new file mode 100644 index 0000000..cd18a23 --- /dev/null +++ b/Mehdi/Clock.c @@ -0,0 +1,37 @@ +#include +#include + +int main() +{ + int h, m, s; + int d = 1000; + printf('Set time :\n'); + scanf("%d%d%d", &h, &m, &s); + if (h > 12 || m > 60 || s > 60) + { + printf("Error ! \n"); + exit(0); + } + while (1) + { + s++; + if (s > 59) + { + m++; + s = 0; + } + if (m > 59) + { + h++; + m = 0; + } + if (h > 12) + { + h = 1; + } + printf("\n Clock :"); + printf("\n %02d:%02d:%02d", h, m, s); + Sleep(d); + system(cls); + } +} \ No newline at end of file diff --git a/Mehdi/Contributing.md b/Mehdi/Contributing.md new file mode 100644 index 0000000..c42ceb7 --- /dev/null +++ b/Mehdi/Contributing.md @@ -0,0 +1,5 @@ +Project idea: Digital Clock in C +Benefit: Check the time + +Source =====> https://www.youtube.com/watch?v=72fIizW3N-8 +Note: This is not my youtube channel.