This commit is contained in:
2025-05-07 14:05:25 +03:00
parent 785c2b0e50
commit 50a27f1d6c
7 changed files with 128 additions and 0 deletions

19
DeitelC/Chapter5/lcm.c Normal file
View File

@ -0,0 +1,19 @@
#include <stdio.h>
int lcm (int, int);
int lcm (int i1, int i2)
{
int i3 = 0;
if (i1 >= i2) {
i3 = i1;
} else {
i3 = i2;
}
for (int i = 2; i < i3; i++) {
if (i1 % i == 0 && i2 % i == 0) {
i3 = i;
}
}
return i3;
}