From 31ded8668758751b137675220e2fc6d00716102c Mon Sep 17 00:00:00 2001 From: estlop Date: Wed, 29 Jun 2022 11:02:55 +0100 Subject: [PATCH] docs: Add readme for sum subject --- subjects/sum/README.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 subjects/sum/README.md diff --git a/subjects/sum/README.md b/subjects/sum/README.md new file mode 100644 index 00000000..2675f0be --- /dev/null +++ b/subjects/sum/README.md @@ -0,0 +1,42 @@ +## sum + +### Instructions + +Write a function that takes two single digit numbers as a string and returns the sum as an int. If one of the arguments is not a single digit number, return 0; + +### Expected function + +```go +func Sum(a,b string) int { + +} +``` + +### Usage + +Here is a possible program to test your function : + +```go +package main + +import ( + "piscine" + "fmt" +) + +func main() { + fmt.Println(piscine.Sum("1", "2")) + fmt.Println(piscine.Sum("-4", "0")) + fmt.Println(piscine.Sum("7", "-3")) +} +``` + +And its output : + +```console +$ go run . | cat -e +3$ +-4$ +4$ +$ +```