Skip to content

Commit 9e803c6

Browse files
Add solution for Challenge 1
1 parent da50e3c commit 9e803c6

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
)
6+
7+
func main() {
8+
var a, b int
9+
// Read two integers from standard input
10+
_, err := fmt.Scanf("%d, %d", &a, &b)
11+
if err != nil {
12+
fmt.Println("Error reading input:", err)
13+
return
14+
}
15+
16+
// Call the Sum function and print the result
17+
result := Sum(a, b)
18+
fmt.Println(result)
19+
}
20+
21+
// Sum returns the sum of a and b.
22+
func Sum(a int, b int) int {
23+
return a + b
24+
}

0 commit comments

Comments
 (0)