Pascal's triangle/Puzzle: Difference between revisions

Scala solution added
(Added Julia language)
(Scala solution added)
Line 2,189:
</pre>
 
=={{header|Scala}}==
<lang Scala>object PascalTriangle extends App {
 
val (x, y, z) = pascal(11, 4, 40, 151)
 
def pascal(a: Int, b: Int, mid: Int, top: Int): (Int, Int, Int) = {
val y = (top - 4 * (a + b)) / 7
val x = mid - 2 * a - y
(x, y, y - x)
}
 
println(if (x != 0) s"Solution is: x = $x, y = $y, z = $z" else "There is no solution.")
}</lang>
{{Out}}See it in running in your browser by [https://scalafiddle.io/sf/UJF14fw/0 (JavaScript)]
or by [https://scastie.scala-lang.org/l0AlwpSdR7i801Fq8CWHEQ Scastie (JVM)].
=={{header|Sidef}}==
{{trans|Perl 6}}
Anonymous user