11th Jul 2020, 8:30 AM
Pankaj Kumar
Pankaj Kumar - avatar
12 Réponses
+ 7
//The main logic was not good #include <stdio.h> int main() { int siblings, popsicles,i; scanf("%d", &siblings); scanf("%d", &popsicles); //your code goes here //replace '?' with correct operator i= popsicles ? siblings; if(i==0) { printf("give away\n"); } else { printf("eat them yourself"); } /*no need this statement else{ printf("there is no popsicles"); }*/ return 0; }
11th Jul 2020, 9:48 AM
᮴Ridwan_
᮴Ridwan_ - avatar
+ 11
Pankaj Kumar check again code coach instruction you going right but u doing mistakes in conditions check it once.
11th Jul 2020, 6:25 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 5
You have attached the link to the question, not the program. For that copy paste the code in code playground and then share it here.
11th Jul 2020, 8:32 AM
Arsenic
Arsenic - avatar
+ 3
Pankaj Kumar you have been provided with the correct solution by ᮴R1 . But he/she want some efforts from your side also. Just figure out what operator will replace "?" And you will be good to go.
11th Jul 2020, 10:23 AM
Arsenic
Arsenic - avatar
+ 3
You got it right 👍
11th Jul 2020, 10:37 AM
Arsenic
Arsenic - avatar
+ 2
?=% Thanks 7R1 and Arsenic.
11th Jul 2020, 10:36 AM
Pankaj Kumar
Pankaj Kumar - avatar
+ 2
Pankaj Kumar There is no need of else if statement. include <stdio.h> int main() { int siblings, popsicles; scanf("%d", &siblings); scanf("%d", &popsicles); if(popsicles%siblings==0){ printf("give away"); } else { printf("eat them yourself"); } return 0; }
11th Jul 2020, 12:06 PM
Varun N
Varun N - avatar
+ 1
Yes, now I have corrected the mistake. Thanks 🙂🙂🙂
12th Jul 2020, 3:26 AM
Pankaj Kumar
Pankaj Kumar - avatar
+ 1
i= popsicles ? siblings
12th Jul 2020, 9:18 AM
Shweta Singh
Shweta Singh - avatar
+ 1
Read and understand
12th Jul 2020, 2:37 PM
Essien Ekanem
Essien Ekanem - avatar
0
#include <stdio.h> int main() { int siblings, popsicles,i; scanf("%d", &siblings); scanf("%d", &popsicles); //your code goes here i=siblings-popsicles; if(i%2==0) { printf("give away\n"); }else if((i%2==1)||(i%2==-1)) { printf("eat them yourself"); } else{ printf("there is no popsicles"); } return 0; }
11th Jul 2020, 8:34 AM
Pankaj Kumar
Pankaj Kumar - avatar
0
Not working
11th Jul 2020, 10:17 AM
Pankaj Kumar
Pankaj Kumar - avatar