+ 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 Respostas
+ 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