A positive natural number, (for e.g.27) can be represented as follows:
2+3+4+5+6+7 8+9+10 13+14
where every row represents a combination of consecutive natural numbers, which add up to 27.
Write a program which inputs a positive natural number N and prints the possible consecutive number combinations, which when added give N.
Test your program for the following data and some random data
INPUT N = 15 OUTPUT 7 8 1 2 3 4 5 4 5 6
Have something to say? Log in to comment on this post.