CSharp examples for System:Math Number
Returns the greatest common divisor of two numbers
using System.Text; using System.Linq; using System.Collections.Generic; using System;/* w ww. jav a 2s.c om*/ public class Main{ /// <summary> /// Returns the greatest common divisor of two numbers /// </summary> /// <param name="a"></param> /// <param name="b"></param> /// <returns></returns> public static int GCD(int a, int b) { if (b == 0) return a; else return GCD(b, a % b); } }