Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,8 @@ In order to achieve greater coverage and encourage more people to contribute to
</a>
</td>
<td> <!-- Scala -->
<a href="./CONTRIBUTING.md">
<img align="center" height="25" src="./logos/github.svg" />
<a href="./src/scala/Exponentiation.scala">
<img align="center" height="25" src="./logos/scala.svg" />
</a>
</td>
<td> <!-- Kotlin -->
Expand Down
9 changes: 9 additions & 0 deletions src/scala/Exponentiation.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
def exponentiation(base: Int, exponent: Int): Int = {
(1 to exponent)
.map(_ => base)
.reduce(_ * _)
}

object Main extends App {
println("5 ^ 3 = " + exponentiation(5, 3));
}