Skip to content

Instantly share code, notes, and snippets.

@cristianpalomino
Created May 12, 2016 02:31
Show Gist options
  • Save cristianpalomino/d2743949a0ff2898dc5226d1d939bfba to your computer and use it in GitHub Desktop.
Save cristianpalomino/d2743949a0ff2898dc5226d1d939bfba to your computer and use it in GitHub Desktop.
MCD
#include <iostream>
#include <stdio.h>
using namespace std;
int mcd1_rec(int m, int n)
{
int r;
r=m%n;
if (r==0)
return(n);
else
return(mcd1_rec(n,r));
}
int main()
{
int m, n;
/*Pide los numeros*/
printf("\nIntroduzca dos numeros:\n");
scanf("%d%*c%d%*c",&m, &n);
printf("RPTA : %d.",mcd1_rec(m,n));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment