Add some theory for Loops
This commit is contained in:
parent
f90ee39d02
commit
ce6de535e5
1 changed files with 15 additions and 0 deletions
15
c_modern_approach/Loops/theory.c
Normal file
15
c_modern_approach/Loops/theory.c
Normal file
|
@ -0,0 +1,15 @@
|
|||
#include <stdio.h>
|
||||
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(); }
|
Loading…
Reference in a new issue