+ 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!"); }
5 Answers
+ 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.
+ 4
Mando
Remove first condition and change second condition to this:
if(criminals<5)
+ 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
+ 1
or zero
+ 1
thanks once more