+ 1

How to do cheer creator in community's Code coach

My 4 test cases got passed but not the 5th one Here is my code #include <stdio.h> int main() { int v; scanf("%d", &v); if(10 < v) { printf ("High Five"); } if(1 > v ) { printf ("shh"); } if(10 > v && !v == 0) { for(int i =0; i < v; i++) { printf("Ra!"); } } return 0; }

8th Feb 2021, 3:08 PM
Vishal
Vishal - avatar
3 Respostas
+ 5
// Change if (10 > v && !v == 0) // To if (10 >= v) // on your last condition Additional: It would be more readable and less confusing if the variable is at the left of comparison and value at the right. ---> if (v <= 10)
8th Feb 2021, 3:17 PM
noteve
noteve - avatar
+ 7
you should check all of your if conditions. the task description specifies that if distance is greater than 10 to output "High Five". what you have done is if(10 < v) ...print("High Five")
8th Feb 2021, 3:22 PM
Lothar
Lothar - avatar
+ 1
Cyan you are correct man I have tried your method and it worked Thanks man And Lothar my all conditions are correct and which was not you were unable to point that out
8th Feb 2021, 3:49 PM
Vishal
Vishal - avatar