Menu
Coddy logo textTech

Sum Combinations

Lesson 10 of 15 in Coddy's Recursion Challenges - Master The Recursive Thinking course.

challenge icon

Challenge

Medium

Write a function named printCombinations that gets an integer num and prints all the possible combinations of numbers from 1 to n having sum n.

Make sure to print the combinations in specific order and way, check the test cases!

The printing can be done in a recursive way, if it's not happening in the main recursive function.

Try it yourself

#include <stdio.h>

void printCombinations(int num) {
    // Write code here
}

All lessons in Recursion Challenges - Master The Recursive Thinking