Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char x='y';
- int m, n;
- while(x=='y'){
- cout<<"Enter numbers (m,n):";
- cin>>m;
- cin.ignore();
- cin>>n;
- cout<<"GCD of "<<m<<" and "<<n<<" is "<<GCD(m,n)<<endl;
- cout<<"Run again? y/n ";
- cin>>x;
- }
- int GCD(int m, int n) {
- if (n==0){
- return m;
- }else {
- return GCD(n, m%n);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement