public/subjects/sum
estlop 402b138983 docs: Rephrase instructions and remove import as per review 2022-07-14 10:33:21 +03:00
..
README.md docs: Rephrase instructions and remove import as per review 2022-07-14 10:33:21 +03:00

README.md

sum

Instructions

Write a function that takes two single digit numbers as a string and returns the sum as an int. The strings can only contain one digit which will be a positive or negative number from 0 to 9. Otherwise, you must return 0.

Expected function

func Sum(a,b string) int {

}

Usage

Here is a possible program to test your function :

package main

import "fmt"

func main() {
	fmt.Println(Sum("1", "2"))
	fmt.Println(Sum("-4", "0"))
	fmt.Println(Sum("7", "-3"))
}

And its output :

$ go run . | cat -e
3$
-4$
4$
$