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; }
6 Antworten
+ 4
anthony rubio , in the if clause use modulo "%" instead of bitwise "&" 🐱
+ 2
if (popsicles % siblings == 0)
cout << "give away";
else if (popsicles % siblings > 0)
cout << "eat them yourself";
+ 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 ?
+ 1
Did not notice that!!!!! Thank you for the help everyone.
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.
0
I tried in python but it was failed