Trying to solve the popsicles problem but it's showing test case 1 green and 3 and 5 red what do I do next to solve the problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Trying to solve the popsicles problem but it's showing test case 1 green and 3 and 5 red what do I do next to solve the problem

18th Jun 2021, 4:38 PM
Samuel Affah
Samuel Affah - avatar
18 Answers
+ 5
This is the link to the task but we cannot see your code. Please try copying it to playground and link it then.
18th Jun 2021, 4:49 PM
Lisa
Lisa - avatar
+ 3
Please link your code so we can help you!
18th Jun 2021, 4:40 PM
Lisa
Lisa - avatar
+ 3
Specify the language too
18th Jun 2021, 4:50 PM
Atul [Inactive]
+ 3
#include <stdio.h> int main() { int siblings, popsicles; scanf("%d", &siblings); scanf("%d", &popsicles); siblings=4; popsicles=8; printf("give away"); return 0; } //Lisa ,🅰🅹 🅐🅝🅐🅝🅣 this is the code attempted my Samuel Affah . So I would like to suggest you to take user inputs. And use if else to check for the availability of popsicles
18th Jun 2021, 5:05 PM
Atul [Inactive]
+ 2
Samuel Affah How to check if you do not provide code?
18th Jun 2021, 5:01 PM
A͢J
A͢J - avatar
+ 2
🅰🅹 🅐🅝🅐🅝🅣 Thanks I'm just realising now that should have put a condition Thanks again
18th Jun 2021, 5:42 PM
Samuel Affah
Samuel Affah - avatar
18th Jun 2021, 4:46 PM
Samuel Affah
Samuel Affah - avatar
+ 1
Please check it on the playground Lisa Atul
18th Jun 2021, 4:59 PM
Samuel Affah
Samuel Affah - avatar
+ 1
Copy to playground, save, share link. Like this for example: https://code.sololearn.com/cUK6Jt1b0wUQ/?ref=app
18th Jun 2021, 5:03 PM
Lisa
Lisa - avatar
+ 1
Check the playground,just search my name you'll see Lisa and atul helppl🅰🅹 🅐🅝🅐🅝🅣
18th Jun 2021, 5:03 PM
Samuel Affah
Samuel Affah - avatar
0
Okay if the number of popsicles divided by children are completely divisible then print give away else eat them
18th Jun 2021, 5:19 PM
Atul [Inactive]
0
Thank you so much Atul
18th Jun 2021, 5:21 PM
Samuel Affah
Samuel Affah - avatar
0
Following you nowAtul
18th Jun 2021, 5:22 PM
Samuel Affah
Samuel Affah - avatar
0
Samuel Affah You have just printed "give away" without checking anything then how all test cases will be passed. Problem says you have a box of popsicles and if you can divide equally to each children then print "give away" otherwise print "eat them yourself". So how to check this you can use modulus operator (%) if reminder is 0 its mean you can divide equally.
18th Jun 2021, 5:28 PM
A͢J
A͢J - avatar
0
Samuel Affah my pleasure
18th Jun 2021, 5:33 PM
Atul [Inactive]
- 3
Please explain
18th Jun 2021, 5:06 PM
Samuel Affah
Samuel Affah - avatar
- 3
How to language
19th Jun 2021, 9:15 AM
Sadiq Bashir tanko
Sadiq Bashir tanko - avatar
- 3
Yes
20th Jun 2021, 2:03 AM
Mamta Kumawat