From ce6de535e58963fea8d8072a8eb2da218452cbec Mon Sep 17 00:00:00 2001 From: pro100ton Date: Sat, 7 Dec 2024 19:38:34 +0300 Subject: [PATCH] Add some theory for Loops --- c_modern_approach/Loops/theory.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 c_modern_approach/Loops/theory.c diff --git a/c_modern_approach/Loops/theory.c b/c_modern_approach/Loops/theory.c new file mode 100644 index 0000000..1d74dae --- /dev/null +++ b/c_modern_approach/Loops/theory.c @@ -0,0 +1,15 @@ +#include +void goto_check() { + int d, n; + for (d = 2; d < n; d++) { + if (n % d == 0) { + goto done; + } + } +done: + if (d < n) + printf("%d is divisable by %d\n", d, n); + else + printf("%d is prime", d); +} +int main() { goto_check(); }