diff --git a/ProblemSolving/GCD.swift b/ProblemSolving/GCD.swift new file mode 100644 index 0000000..077056b --- /dev/null +++ b/ProblemSolving/GCD.swift @@ -0,0 +1,13 @@ +//Sayed Mahmudul Alam +//Greatest Common Divisor + +struct GCD { + func getGCD(a: Int, b: Int) -> Int { + let r = a % b + if r != 0 { + return getGCD(a: b, b: r) + } else { + return b + } + } +} \ No newline at end of file