0

Code coach popsicles challenge

//mycode: #include <stdio.h> int main() { int siblings, popsicles; scanf("%d", &siblings); scanf("%d", &popsicles); //your code goes here if (siblings && popsicles ==0){ printf("give away"); } else{ printf("eat them yourself"); } return 0; } My code fails in second step and I don't know what operators or functions should I use please someone give me a clue...

11th Oct 2025, 9:04 AM
Axxcii
Axxcii - avatar
2 Réponses
0
If the number is evenly divisible by the number of siblings, we are supposed to give the popsicles to them. Hence, we need to find out if popsicles / siblings is 0 (evenly divisible) or not. This is also called integer division or modulo or "division with remainders". We check if the remainder is 0 or not. In C, there is a dedicated modulo operator: %.
11th Oct 2025, 10:03 AM
Lisa
Lisa - avatar
0
Lisa yes got some let me try
11th Oct 2025, 10:04 AM
Axxcii
Axxcii - avatar