+ 2

(SOLVED) Cheer Creator problem

I've been trying to solve this problem for a while now, but I can't find an answer to it. Here is my code. Test case 3 and 4 fails with it. int yards = Console.Read(); yards -= 48; if(yards < 1) { Console.WriteLine("shh"); } else if(yards <= 10) { for(int i = 0; i < yards; i++) { Console.Write("Ra!"); } } else if(yards > 10) { Console.WriteLine("High Five"); }

2nd Feb 2020, 1:05 PM
Tamas Drenyovszki
1 Antwort
0
Why do you need - = 48? Anyway I used this to get yard inputs: int yard = Convert.ToInt32(Console.ReadLine()); Rest of the code is similar, however you are missing an else statement. If( condition 1) Output: shh Else if(conditions 2) Output Ra! else High five No condition is needed for the last evaluation for this task
2nd Feb 2020, 1:23 PM
HNNX 🐿
HNNX 🐿 - avatar