Problem 43639. Counting candies
In a classroom of 'n' children, every even numbered child gets one big candy and every odd numbered child gets two small candies. Count the total number of candies 'x' that one should bring to the class.
For example, if there are n = 10 children in the class, the first child gets two candies, second child gets one candy, third child gets two candies and so on. Total number of candies required is x = 15.
Solution Stats
Solution Comments
Show commentsProblem Recent Solvers71
Suggested Problems
-
Replace NaNs with the number that appears to its left in the row.
2957 Solvers
-
741 Solvers
-
Sum the numbers on the main diagonal
572 Solvers
-
Matrix of almost all zeros, except for main diagonal
180 Solvers
-
Sum positive elements of matrix.
119 Solvers
More from this Author1
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!