+ 1
Cheer creator
What's wrong here? 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) { Convert.Tolnt32 (Console.RideLine()); int = yards; if yards < 1 { Console. Write ("shh"); } else if ( yards <=10 ) { for (int g = 1; g < yards; g++ ) { Console.Write ("Ra!"); } else if (yards > 10) { Console. Write ("High Five"); } } } }
11 Respostas
0
Gleb When you type, Console.Readline() save your Enter button (or \n), thats not a valid character to convert by using Convert.ToInt32.
You should use:
int yards = int.Parse(Console.Readline())
+ 3
how many RA! for three yards?
(one too less)
0
You should set int g=0 in for loop. Because loop stops when g<yards (which means g==yards-1, and it just loops (yards-1) times). This is not expected answer.
0
Still a mistake, something with Convert.Tolnt32
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.Tolnt32 (Console.ReadLine());
if (yards < 1)
{
Console. WriteLine ("shh");
}
else if ( yards <=10 )
{
for (int g = 0; g < yards; g++ )
{
Console.WriteLine ("Ra!Ra!Ra!Ra!Ra!");
}
}
else if (yards > 10)
{
Console. WriteLine ("High Five");
}
}
}
}
0
a bit too Raa!
one for each yard is enough😉
0
And what a mistake with Tolnt?
0
usercode/file0.(cs14,19): error CS0117: 'Convert' does not contain a definition for 'Tolnt32'
0
Gleb Be carefull you wrote lnt with "L" not with "I"
0
When you had a string saved, use Convert.ToInt32. If you havent had already, use int.Parse()
0
Thanks man
0
Gleb glad to help