0

What's wrong with this code?

I'm trying to resolve the "Cheer maker" challenge, but only the 4th case is wrong, do you notice something wrong with this code? https://code.sololearn.com/cBFzxGWY3C4N/?ref=app

21st Apr 2021, 11:13 AM
Alexis André García Martínez
Alexis André García Martínez - avatar
5 odpowiedzi
+ 1
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { int yards = Convert.ToInt32(Console.ReadLine()); if (yards<1) { Console.Write("shh"); } else if (yards>=1 && yards<=10) { for (int ras = 0 ;ras<yards; ras++) { Console.Write("Ra!"); } } else if (yards>10){ Console.Write("High Five"); } } } }
21st Apr 2021, 1:43 PM
Atul [Inactive]
+ 1
Remove the last curly bracket
21st Apr 2021, 1:44 PM
Atul [Inactive]
+ 1
And in else if condition write yards<=10
21st Apr 2021, 1:44 PM
Atul [Inactive]
+ 1
Oh thanks!, It worked
21st Apr 2021, 1:46 PM
Alexis André García Martínez
Alexis André García Martínez - avatar
+ 1
My pleasure
21st Apr 2021, 6:20 PM
Atul [Inactive]