Start learning free

LESSON 51 OF 671 · CALCULATIONS - CHALLENGES

Your First Challenge in Go

Practice

In this lesson we will introduce you to how coding challenges work and how to make the most out of them.

Sum of Two Numbers

You are given two numbers a and b. Return their sum.

Example:

Input: a = 4, b = 9
Output: 13
Explanation: The sum of a and b is 4 + 9, which is 13.

The function

In Go, the starter code gives you a function with parameters. The parameters represent the challenge input:

func sum(a int, b int) int {
    // Your code goes here
}

The int after the parameter list means the function must return an integer.

For this challenge, return a + b.

Assignment
Follow the Coding Tutorial and return the sum of the two inputs.

STEP 1 OF 1
    Ctrl + Enter to check