Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren0
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
5 Antworten
+ 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");
}
}
}
}
+ 1
Remove the last curly bracket
+ 1
And in else if condition write yards<=10
+ 1
Oh thanks!, It worked
+ 1
My pleasure