From 1043be57babf7de835217653089f2316c4f560cd Mon Sep 17 00:00:00 2001 From: "go-interview-practice-bot[bot]" <230190823+go-interview-practice-bot[bot]@users.noreply.github.com> Date: Sat, 6 Dec 2025 12:20:09 +0000 Subject: [PATCH 1/2] Add solution for Challenge 1 --- .../submissions/cckwes/solution-template.go | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 challenge-1/submissions/cckwes/solution-template.go diff --git a/challenge-1/submissions/cckwes/solution-template.go b/challenge-1/submissions/cckwes/solution-template.go new file mode 100644 index 000000000..3e21df932 --- /dev/null +++ b/challenge-1/submissions/cckwes/solution-template.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" +) + +func main() { + var a, b int + // Read two integers from standard input + _, err := fmt.Scanf("%d, %d", &a, &b) + if err != nil { + fmt.Println("Error reading input:", err) + return + } + + // Call the Sum function and print the result + result := Sum(a, b) + fmt.Println(result) +} + +// Sum returns the sum of a and b. +func Sum(a int, b int) int { + return a + b +} From 45c985a94a98fba2b945b729165783d0be8fd5f0 Mon Sep 17 00:00:00 2001 From: Wesley Chong Date: Sat, 6 Dec 2025 20:37:28 +0800 Subject: [PATCH 2/2] address PR comment --- challenge-1/submissions/cckwes/solution-template.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/challenge-1/submissions/cckwes/solution-template.go b/challenge-1/submissions/cckwes/solution-template.go index 3e21df932..ff3116687 100644 --- a/challenge-1/submissions/cckwes/solution-template.go +++ b/challenge-1/submissions/cckwes/solution-template.go @@ -7,8 +7,8 @@ import ( func main() { var a, b int // Read two integers from standard input - _, err := fmt.Scanf("%d, %d", &a, &b) - if err != nil { + n, err := fmt.Scanf("%d, %d", &a, &b) + if err != nil || n != 2 { fmt.Println("Error reading input:", err) return } @@ -20,5 +20,5 @@ func main() { // Sum returns the sum of a and b. func Sum(a int, b int) int { - return a + b + return a + b }