Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int DingDong(int a , int b)
- {
- while(b)
- {
- int r = a % b;
- a = b;
- b = r;
- }
- return a;
- }
- int main()
- {
- int n , x , y , z , max = 0 , div;
- cin >> n;
- for(int i = 1 ; i <= n ; i++)
- {
- cin >> x;
- if(i == 1)
- div = x;
- div = DingDong(div , x);
- }
- cout << div;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement