Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

132937 views
License: OTHER
1
object TwoBases {
2
def test(x: Int, y: Int, z: Int) =
3
(100*x + 10*y + z == math.pow(9,2)*z + 9*y + z)
4
5
def main(args: Array[String]) {
6
for(x <- 0 to 9; y <- 0 to 9; z <- 0 to 9) {
7
if(test(x, y, z)){
8
println("%d%d%d".format(x, y, z));
9
}
10
}
11
}
12
}
13