Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // CF_TR4_B
- #include <iostream>
- #include <stdio.h>
- using namespace std;
- int gcd(int x, int y)
- {
- if (x == 0) return y;
- else return gcd(y%x, x);
- }
- int main()
- {
- int n;
- //cin >> n;
- scanf("%d", &n);
- int mas[101];
- for (int i = 0; i < n; i++)
- scanf("%d", &mas[i]);
- int ans = 0;
- for (int i = 1; i < n; i++)
- ans = gcd(mas[0], mas[i]);
- //cout << ans;
- printf("%d", ans);
- //system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement