Smart Calculator (Kotlin). Stage 8/8

Very big

Report a typo

Description

In this stage, your program must support arithmetic operations (+, -, *, /) with very large numbers as well as parentheses to change the priority within an expression.

There are two ways to solve it. As an easy way, you may use the standard class for working with large numbers, just correctly apply it to your solution. If you want to practice algorithms, you may develop your own class for large numbers and implement algorithms for the listed arithmetic operations.

Example

The greater-than symbol followed by a space (>) represents the user input.

> 112234567890 + 112234567890 * (10000000999 - 999)
1122345679012234567890
> a = 800000000000000000000000
> b = 100000000000000000000000
> a + b
900000000000000000000000
> /exit
Bye!

The program should not stop until the user enters the /exit command.

Write a program
package calculator

fun main() {
println("Hello, World!")
}

___

Create a free account to access the full topic

Topics in stage