Untitled
unknown
plain_text
2 years ago
271 B
7
Indexable
#include <iostream>
int LCM(int a, int b, int c) {
int i = 2;
while (true) {
if (i % a == 0 && i % b == 0 && i % c == 0) {
return i;
}
else i++;
}
}
int main() {
std::cout << "LCM: " << LCM(18, 20, 45);
return 0;
}Editor is loading...
Leave a Comment