Cheer Creator Problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Cheer Creator Problem

My code in C# does not seem to bypass Test Case Number 4. Please find the code below : -_-_-_-_-_-_-_-_-_-_-_-_--_-_-_-_ 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; yards=Convert.ToInt32(Console.ReadLine()); if(yards > 10) { Console.WriteLine("High Five"); } else if(yards < 1) { Console.WriteLine("shh"); } for(int i=1;i<=yards;i++) { if(yards > 1 && yards <10) { Console.WriteLine("Ra!"); } } } } }

13th Mar 2020, 8:38 AM
Kaushik Poojari
Kaushik Poojari - avatar
2 Answers
+ 1
You need to put for loop as else part of last if. It has to run only if first 2 conditions fails..., then you can remove if condition in loop.. Or else Interchange last if and for like if(yards>=1 and yards <=10) { for(int i=0;i<yards;i++) print Ra!
13th Mar 2020, 8:59 AM
Jayakrishna 🇮🇳
+ 2
Ok three problems found as follows: 17 if(yards >= 10) //10 yards or more "High Five" 28 if(yards >= 1 && yards < 10) //1 yard up to 9 yards "Ra" 30 Console.Write("Ra!"); //"Ra!" printed on same line
13th Mar 2020, 9:29 AM
BroFar
BroFar - avatar