Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n,a,b,cmmdc,r,i;
- cout<<"Introduceti nr de nr din sir: "; cin>>n;
- cout<<"a= "; cin>>a;
- for (i=2; i<=n; i++)
- {
- cout<<"b= "; cin>>b;
- if (b!=0)
- {
- do
- {
- r=a%b;
- a=b;
- b=r;
- }while (r!=0);
- }
- }
- if (a==0)
- cout<<"Cmmdc nedefnit";
- else
- cout<<"Cmmdc este: "<<a;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement