Skip to content

Instantly share code, notes, and snippets.

@abreslav
Created November 11, 2014 09:12
Show Gist options
  • Select an option

  • Save abreslav/173c32a30f9f94e1cd9a to your computer and use it in GitHub Desktop.

Select an option

Save abreslav/173c32a30f9f94e1cd9a to your computer and use it in GitHub Desktop.

Revisions

  1. abreslav created this gist Nov 11, 2014.
    10 changes: 10 additions & 0 deletions ratio.kt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    class Ratio(num : Int, denom : Int) {
    val numerator: Int
    val denominator: Int

    {
    val theGcd = gcd(num, denom)
    numerator = num / theGcd
    denominator = denom / theGcd
    }
    }