Created
July 30, 2016 13:59
-
-
Save SuperJMN/82503d1c5d313087aa2caaf93d199a9d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Mcd | |
{ | |
class MainClass | |
{ | |
public static void Main (string[] args) | |
{ | |
Console.WriteLine (Calculo.Mcd(75, 100)); | |
} | |
} | |
public static class Calculo | |
{ | |
public static int Mcd(int a, int b) | |
{ | |
var mayor = Math.Max (a, b); | |
var menor = Math.Min (a, b); | |
return McdOrdenado (mayor, menor); | |
} | |
private static int McdOrdenado(int mayor, int menor) | |
{ | |
var resto = mayor % menor; | |
if (resto == 0) | |
return menor; | |
else | |
return Mcd (menor, resto); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment