Last active
May 24, 2019 23:49
-
-
Save Bunyod/8c0c2389825adc581e44714c8735c722 to your computer and use it in GitHub Desktop.
Print a document as a book
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package utils | |
/** | |
* @author Bunyod Bobojonov ([email protected]). Created at 6/1/16. | |
*/ | |
object Pagination { | |
def main(args: Array[String]): Unit = { | |
println("Hello World from main function!") | |
var evens = "" | |
var odds = "" | |
val n = 100 // number of pages | |
val m = n/2 | |
for (i <- 1 to m+1) { | |
if (i%2 == 0) { | |
evens = evens + s"$i,${2*(m-i) + (i+1)}," | |
} else { | |
odds = odds + s"${2*(m-i) + (i+1)},$i," | |
} | |
} | |
println(evens) | |
println("-----------------------") | |
println(odds) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment