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!

+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

6/18/2021 4:38:39 PM

Samuel Affah

19 Answers

New Answer

+5

This is the link to the task but we cannot see your code. Please try copying it to playground and link it then.

+3

Please link your code so we can help you!

+3

Specify the language too

+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

+2

Samuel Affah How to check if you do not provide code?

+2

πŸ…°πŸ…Ή πŸ…πŸ…πŸ…πŸ…πŸ…£ Thanks I'm just realising now that should have put a condition Thanks again

+1

https://www.sololearn.com/coach/3?ref=app

+1

Please check it on the playground Lisa Atul

+1

Copy to playground, save, share link. Like this for example: https://code.sololearn.com/cUK6Jt1b0wUQ/?ref=app

+1

Check the playground,just search my name you'll see Lisa and atul helpplπŸ…°πŸ…Ή πŸ…πŸ…πŸ…πŸ…πŸ…£

0

Okay if the number of popsicles divided by children are completely divisible then print give away else eat them

0

Thank you so much Atul

0

Following you nowAtul

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.

0

Samuel Affah my pleasure

0

This is the solution in c++. You can easily convert it to other languages #include <iostream> using namespace std; int main() { int siblings, popsicles; //take input cin>>siblings>>popsicles; //your code goes here if(!(popsicles % siblings) ) cout << "give away"; else cout << "eat them yourself"; return 0; }

-3

Please explain

-3

How to language

-3