Question: Consider all codes made of four digits ( 0 9 ) . How many of them have a sum of digits equal to S ?
Consider all codes made of four digits How many of them have a sum of digits equal to S For example, for S there are such codes in total. Some of them are
Write a function:
int solutionint S;
that, given an integer S returns the number of fourdigit codes whose sum of digits is equal to S
Examples:
For S the possible codes are: The function should return
For S the function should return
For S the function should return
Assume that:
S is an integer within the range
In your solution, focus oncorrectness The performance of your solution will not be the focus of the assessment.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
