For many families at Christmas, each family member gives 1 present to every other family member. The main exception is that children under the age of 16 do not contribute any presents. If there is only 1 child in the family, then that child is considered "spoilt" and receives 2 presents from each adult instead.
Given the size of a family (Nf) and the number of children under the age of 16 (Nc), find the number of presents under the Christmas tree!
Solution Stats
Problem Comments
1 Comment
Solution Comments
Show comments
Loading...
Problem Recent Solvers204
Suggested Problems
-
Given an unsigned integer x, find the largest y by rearranging the bits in x
2069 Solvers
-
Back to basics 22 - Rotate a matrix
939 Solvers
-
Number of 1s in a binary string
11558 Solvers
-
Is the paranthesis sequence balanced ?
206 Solvers
-
Electrical Diode Current Calculation
1292 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
For Test1, shouldn't y_correct = 16 and not 20.