Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <algorithm>
- using namespace std;
- /*
- LCM
- 2568
- 7765
- */
- int
- gcd (int a, int b)
- {
- while ( a != 0 ) {
- b %= a;
- swap (a,b);
- }
- return b;
- }
- int
- main(void)
- {
- const int g = gcd (2568,7765);
- const int lcm = g * 2568 * 7765;
- printf ("%d\n",lcm);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement