Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int gcd1(int y, int z)
- {
- if (z == 0)
- {
- return y;
- }
- else if (y == 0)
- {
- return z;
- }
- else
- {
- return gcd1(z, y % z);
- }
- }
- int lcm(int y, int z) {
- return (y * z) / gcd1(y, z);
- }
- int main() {
- int x, y, z;
- cin >> x >> y >> z;
- if (x < 10 || x > 100 || y < 10 || y > 100 || z < 10 || z > 100) {
- cout << "Invalid input data! \n";
- return 1;
- }
- int result = lcm(lcm(x,y), z);
- cout << result;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement