Skip to content

Duration.GreatestCommonDivisor

Chanan edited this page Aug 15, 2020 · 1 revision

Duration.GreatestCommonDivisor Method

Namespace: CW.Soloist.CompositionService.MusicTheory
Assembly: CW.Soloist.CompositionService.dll


Summary

Utility static method for calculating GCD of two numbers with Euclids'es algorithm.


Returns

The Greatest Common Divisor (GCD) of the two given number a and b.


Source Code

internal static int GreatestCommonDivisor(int a, int b)
{
    if (b == 0)
        return a;
    return GreatestCommonDivisor(b, a % b);
}
  • Home
  • Getting Started
  • Design
    • Business Logical Layer (CW.Soloist.CompositionService)
    • Data Access Layer
    • Presentation Layer
Clone this wiki locally