I want Addition where result return type is string, but Result does not match when Addition uses Kotlin programming language
Problems example: Suppose I have 2 large strings of numbers like:
"3334567891011121314151648"
"12345678911"
Example outputs:
3334567891011133659830559
Write a program to add the two numbers together and the result return type is a string using Kotlin.
This is my coding:
fun sum(n1: String, n2: String) : String {
return "%.0f".format(n1.toDouble() + n2.toDouble()).toString()
}
fun main() {
println(sum("3334567891011121314151648", "12345678911"))
}
But a result like this doesn't match the example output:
3334567891011134000000000
What is the solution with my coding so that the results match the example output above.