diff options
| author | Hyder <hyder@hyderhadi.xyz> | 2025-08-01 12:34:54 +0300 |
|---|---|---|
| committer | Hyder <hyder@hyderhadi.xyz> | 2025-08-01 12:34:54 +0300 |
| commit | 2d5fc9c45bd3f7a1128096317acee6b93dce1ec9 (patch) | |
| tree | 96680b07ac98a6694e1bd6f65c77051c90a154c5 | |
| parent | 75adb397234b3a67699f2cda2b75b960f4d4ceb3 (diff) | |
Im organizing things like a pro XD
| -rw-r--r-- | GCD/GCD.c | 23 | ||||
| -rw-r--r-- | GCD/README.md | 5 |
2 files changed, 28 insertions, 0 deletions
diff --git a/GCD/GCD.c b/GCD/GCD.c new file mode 100644 index 0000000..2f857f8 --- /dev/null +++ b/GCD/GCD.c @@ -0,0 +1,23 @@ +# include <stdio.h> + +int GreatestCommonDivisor(int INPUT_ONE, int INPUT_TWO) { + int DIVISOR; + for (int i = 1; i < INPUT_ONE || i < INPUT_TWO;++i) { + if (INPUT_ONE % i == 0 && INPUT_TWO % i == 0) { + DIVISOR = i; + } + } + return DIVISOR; +} + + +int main() { + int INPUT_ONE; + int INPUT_TWO; + printf("Give me a TWO numbers to find GCD\n"); + while (scanf("%d %d", &INPUT_ONE, &INPUT_TWO) != EOF) { + int RESULT = GreatestCommonDivisor(INPUT_ONE, INPUT_TWO); + printf("%d\n\n", RESULT); + } + return 0; +}
\ No newline at end of file diff --git a/GCD/README.md b/GCD/README.md new file mode 100644 index 0000000..d72b73f --- /dev/null +++ b/GCD/README.md @@ -0,0 +1,5 @@ +# GCD calculator + +**Im just writing a readme markdown file to see how this works** + +## This is a simple program written in C to calculate the Greatest Common Divisor of two positive integers its a part of some random exercises im trying to solve.
\ No newline at end of file |
