Apples
Lesson 20 of 32 in Coddy's Coding Problems course.
Challenge
MediumYou have 4 kids. Your neighbor comes at your door and gives you N (N > 4) apples. You want to divide them equally among your children, so if the number isn't divisible with 4, you need to buy more apples. An apple costs 1$, output how many dollar you'll spend to split them among your kids. You should spend as little as possible.
Write the function to calculate the above, name it apples.
Input
8
Output
0
Input
10
Output
2
Try it yourself
int apples(int a1) {
// Write code here
}All lessons in Coding Problems
1Course Introduction
Introduction