//Visual Basic 2010 Recursie Procedures en Functies public class Example3 { void Main() { Console.WriteLine(this.GetCommonDivisor(3, 9)); Console.WriteLine(this.GetCommonDivisor(3, -9)); Console.WriteLine(this.GetCommonDivisor(8, 3)); Console.WriteLine(this.GetCommonDivisor(-3, -8)); Console.WriteLine(this.GetCommonDivisor(6, 0)); Console.WriteLine(this.GetCommonDivisor(0, 6)); Console.WriteLine(this.GetCommonDivisor(8, 12)); Console.WriteLine(this.GetCommonDivisor(9, 9)); Console.ReadLine(); } void GetCommonDivisor(int value1, int value2) { if ((value1 < 0)) { GetCommonDivisor = this.GetCommonDivisor(value1, value2); } else { GetCommonDivisor = this.GetCommonDivisor(value2, (value1 % value2)); } } } //Bezoek www.vbvoorbeelden.be voor meer C# voorbeelden. //Copyright - De Wolf / vbvoorbeelden - 2003-2011 - Alle rechten voorbehouden.