0
Can someone help me with Popsicle problem with a c++ program
12 Antworten
+ 3
*SPOILER ALERT*
https://code.sololearn.com/c9Os3RzXgAi4/?ref=app
+ 1
Here is the code in simple language.
#include <iostream>
using namespace std;
int main() {
int siblings, popsicles;
//take input
cin>>siblings>>popsicles;
if (popsicles /siblings && popsicles % siblings == 0)
{
cout << " give away";
}
else {
cout << " eat them yourself " ;
}
return 0;
}
0
Hadeed Tarar ??
0
0
Hadeed Tarar it's a link of popsicles question you must save code after writing it.
0
Hadia [Gone Heartless] thanks
0
Here is my code i think its foolproof
#include <iostream>
using namespace std;
int main() {
int p,s,m,c2;
cin>>s;
cin>>p;
m = p%s;
c2 = (p/s)*s;
if (m==0||c2==p && p<s ){
cout<<"give away";
}
else {
cout<<"eat them yourself";
}
return 0;
}