Challenge 1: Sum of Two Numbers

Test your knowledge by writing a subroutine to calculate the sum of two numbers.

Problem statement

Write a subroutine sum that takes two integer parameters and returns their sum.


Two numbers.


Sum of the two numbers.

Sample input

4, 5

Sample output


Coding exercise

Write your code in the code widget below. If you don’t get it right, don’t fret; the solution is also given.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy