Advertisement
edutedu

problema 2

Sep 23rd, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. int n, i, a[100], b,c;
  2. cin>>n;
  3. for(i=0; i<n; i++
  4. cin>>a[i];
  5. b=a[0];
  6. for(i=1; i<n; i++)
  7. {
  8. b=a[i];
  9. while(a!=b)
  10. {
  11. if(a>b)
  12. a=a-b;
  13. else
  14. b=b-a;
  15. }
  16. a=b;
  17. }
  18. cout<<"cmmdc este: "<<a;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement