+ 1

i cannot pass the fifth test case(its hidden) in gotham city. help me find the bug in my snippet below.

#include <stdio.h> int main() { int criminals; scanf("%d",&criminals); if(criminals<=0) return NULL; else if(criminals>0&&criminals<5) printf("I got this!"); else if(criminals>4&&criminals<11) printf("Help me Batman"); else printf("Good Luck out there!"); }

27th Aug 2021, 7:49 PM
socka
socka - avatar
5 odpowiedzi
+ 5
Mando Yes there maybe possibility to have negative value. We think criminals can't be negative and it's true but in test cases maybe negative values.
28th Aug 2021, 2:38 AM
A͢J
A͢J - avatar
+ 4
Mando Remove first condition and change second condition to this: if(criminals<5)
27th Aug 2021, 7:57 PM
A͢J
A͢J - avatar
+ 2
A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟ thanks it worked. does this mean the test case was a negative value
27th Aug 2021, 8:32 PM
socka
socka - avatar
+ 1
or zero
27th Aug 2021, 9:15 PM
socka
socka - avatar
+ 1
thanks once more
28th Aug 2021, 4:26 AM
socka
socka - avatar