Pascal's triangle/Puzzle: Difference between revisions

Added Julia language
(Added Julia language)
Line 1,378:
|5 11 13 4 8|
+-----------+</pre>
 
=={{header|Julia}}==
{{works with|Julia|0.6}}
{{trans|Kotlin}}
 
<lang julia>function pascal(a::Integer, b::Integer, mid::Integer, top::Integer)
yd = round((top - 4 * (a + b)) / 7)
!isinteger(yd) && return 0, 0, 0
y = Int(yd)
x = mid - 2a - y
return x, y, y - x
end
 
x, y, z = pascal(11, 4, 40, 151)
if !iszero(x)
println("Solution: x = $x, y = $y, z = $z.")
else
println("There is no solution.")
end</lang>
 
{{out}}
<pre>Solution: x = 5, y = 13, z = 8.</pre>
 
=={{header|Kotlin}}==
Anonymous user