0

Popsicle

I can ot get 5/5 task tasks complete ...... #include <iostream> using namespace std; int main() { int siblings, popsicles; //take input cin>>siblings>>popsicles; //your code goes here if (popsicles & siblings == 0) { cout <<"give away"; } else{ cout <<"eat them yourself"; } return 0; }

17th Jan 2020, 11:00 PM
anthony rubio
6 Antworten
+ 4
anthony rubio , in the if clause use modulo "%" instead of bitwise "&" 🐱
17th Jan 2020, 11:10 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 2
if (popsicles % siblings == 0) cout << "give away"; else if (popsicles % siblings > 0) cout << "eat them yourself";
27th Mar 2020, 9:27 PM
Abraham
Abraham - avatar
+ 2
#include <stdio.h> int main() { int sib; int pop; int resl; scanf("%d", &sib); scanf("%d", &pop); resl=pop%sib; if(resl==0) { printf("give away"); } else { printf("eat them"); } return 0; } Here is my code in C but Test 1 and 4 failed why ?
5th Oct 2020, 1:04 AM
Biplab Sharma
Biplab Sharma - avatar
+ 1
Did not notice that!!!!! Thank you for the help everyone.
18th Jan 2020, 2:48 AM
anthony rubio
0
That code you posted says: If popsicles equals 1 and siblings equals 0, give away. You need to work with the remainder of the division. If popsicles % siblings == 0 || siblings % popsicles == 0, give away.
18th Jan 2020, 1:27 AM
Fernando Pozzetti
Fernando Pozzetti - avatar
0
I tried in python but it was failed
21st Jan 2020, 9:49 AM
Padma balaji
Padma balaji - avatar