Skip to content

Instantly share code, notes, and snippets.

@fornext1119
Created January 11, 2013 07:24
Show Gist options
  • Save fornext1119/4508688 to your computer and use it in GitHub Desktop.
Save fornext1119/4508688 to your computer and use it in GitHub Desktop.
scala.util.control.Breaks.breakable {
for (i <- 999 to 100 by -1; j <- 0 to 1) {
var x = i
var y = i - j
do {
if (x % 11 == 0 || y % 11 == 0 ) {
var s = (x * y).toString
if (s == s.reverse) {
println(x + " * " + y + " = " + s)
scala.util.control.Breaks.break
}
}
x += 1
y -= 1
} while (x <= 999)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment