Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int x, y;
- int NWD(int a, int b){
- if(a%b==0){
- return b;
- }
- else{
- while(a%b!=0){
- int c;
- c=a%b;
- a=b;
- b=c;
- }
- return b;
- }
- }
- int main()
- {
- cout << "Podaj dwie liczby, aby obliczyc NWD" << endl;
- cin>>x;
- cin>>y;
- cout<<NWD(x,y);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment