Skip to content

Instantly share code, notes, and snippets.

View i10416's full-sized avatar
๐Ÿ™ƒ

110416 i10416

๐Ÿ™ƒ
View GitHub Profile
@i10416
i10416 / gcd_and_lcm.sc
Created July 5, 2021 07:21
gcd and lcm implementation in scala script
// scala 2.13.6
// ammonite 2.4.0
import scala.math.Integral
import scala.math.{ BigDecimal, BigInt }
object NumericUtil {
def gcd[T: Integral](a: T, b: T): T = {
if (b == 0) {
a
@i10416
i10416 / gcd.sc
Last active July 5, 2021 06:50
gcd implementation in scala script
// scala 2.13.6
// ammonite 2.4.0
import scala.math.Integral
import scala.math.{BigDecimal,BigInt}
object NumericUtil {
def gcd[T :Integral](a:T,b:T):T = {
if(b == 0){
a