Coding ExercisesInterview Tuesday

Ruby Coding Interview Question: Build a Dynamic Sum Method

This coding exercise walks through how to build a method that takes a single integer as an argument and builds a sum of all of the integers counting up to the argument value.


Build a program that sums all of the integers up to, and including any value passed in as an argument.

Exercise File

Code File

Exercise Description

The program should be able to take in a single argument of an integer, and output the sum of all of the integers up to the argument’s value.

Sample Input


Sample Output


Real World Usage

This is a common Ruby coding interview question. Additionally, being able to create dynamic ranges and perform calculations on the collection is important in a number of applications.


Can be found on the solutions branch on github.

Jordan Hudgens
the authorJordan Hudgens

Leave a Reply