题目
两个大数相加(这两个大数之和超过了int64),使用go语言实现这样的加法。
实现
package main
import (
"bufio"
"fmt"
"os"
"strings"
)
func bigNumberAdd(num1, num2 string) (result string) {
num1Index := len(num1) - 1
num2Index := len(num2) - 1
resultIndex := 0
if num1Index == -1 && num2Index == -1 {
return "0"
}
for _, c := range num1 {
if c < 48 || c > '9' {
fmt.Println("num1 is invalid")
os.