Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- using namespace std;
- int nwd(int a, int b)
- {
- while(a!=b)
- {
- if(a>b)
- a=a-b;
- else
- b=b-a;
- }
- return a;
- }
- int main()
- {
- int a,b;
- cout<< "podaj pierwsza liczbe a:";
- cin>>a;
- cout<<"podaj druga liczbe b:";
- cin>>b;
- cout<< "nwd("<< a << "," << b << ") ma wartosc: " <<nwd(a,b);
- cin.ignore();
- getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement