Advertisement
everblut

Maximo comun denominador

Mar 8th, 2011
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. // C++ Mcd
  2. namespace std;
  3.  
  4. #include <iostream>
  5.    
  6. int mcd(int a, int b)
  7. {
  8.     if(b==0)
  9.        return a;
  10.     else
  11.        return mcd(b, a%b);
  12. }
  13.  
  14. int main(int argi,char* argv[])
  15. {
  16.     int a, b, B;
  17. cout<<"\nIngrese el primer numero: ";
  18. cin>>a;
  19.  
  20. cout<<"\nIngrese el segundo numero: ";
  21. cin>>b;
  22.  
  23. B = mcd(a,b);
  24. cout<<"el Mcd es "<<B<<"\n";
  25.  
  26. return0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement