Description: Obtaining a sum from a subsequence of digits
Write a program that prompts the user for two numbers: an unsigned long , say digits, and an int, say sum, and outputs the number of ways of selecting digits from digits that sum up to sum. For instance, if digits is 12234 and sum is 5 then there are 4 solutions:
• one solution is obtained by selecting 1 and both occurrences of 2 (1+ 2+ 2 = 5) • one solution is obtained by selecting 1 and 4 (1+ 4 = 5)
• one solution is obtained by selecting the first occurrence of 2 and 3 (2+ 3 = 5)
• one solution is obtained by selecting the second occurrence of 2 and 3 (2+ 3 = 5).
To Search:
File list (Check if you may need any files):
question1.c