I assume that
n
is not to be input in the inner loop, but to be given as a parameter (otherwise the user had to answer many prompts over the next 1000 years).
In that case your code answers the questions: How many combinations of numbers i1 to i10 exists such that their sum is smaller than
n
, where i1 to i10 are in the range of 0 ... 99 and mutually distinct and in increasing order. Now, that question can be answered analytically, without enumerating all possible combinations of i1 to i10. Here is a hint how it's done:
Consider the simple case of only two variables i1 and i2, each in the range of 1 ... 5 and n = 8. Now you can visualize the combinations of i1 and i2 in the following diagram:
i2 1 2 3 4 5
i1
1 * * * * *
2 * * * * *
3 * * * *
4 * * *
5 * *
The * means that the sum of i1 and i2 is smaller than 7.
Can you see how many combinations there exist? (5 * 5) - 1 - 2 - 3 = 19. Actually, your code does only count the combinations for which the in are mutually distinct and ordered. But you can account for that. Now, the only thing you have to do is construct the general formula for your case and to generalize the problem from 2 to 10 dimensions, which should not be all that hard to do. The resulting code will run a lot faster, probably some micro seconds instead of a thousand years. Some improvement, I guess.