
Sarachoudry@yahoo.com Choudry
7,081 Pointswhat am I missing?
please help
using System;
namespace Treehouse.CodeChallenges
{
class Program
{
static void Main()
{
Console.Write("Enter the number of times to print \"Yay!\": ");
string input = Console.ReadLine();
int counter = 0;
try
{
var total = int.Parse(entry);
while(total > counter)
{
i += 1;
Console.WriteLine("Yay!");
}
}
catch(FormatException)
{
Console.WriteLine("You must enter a whole number");
}
}
}
}
1 Answer

Gabriel Pierce-Lackey
11,012 PointsYou are misslabeling some variables. I believe you mean to use "counter" instead of i and "input" instead of entry. You have "i" instead of what you actually previously named these variables.
using System;
namespace Treehouse.CodeChallenges
{
class Program
{
static void Main()
{
Console.Write("Enter the number of times to print \"Yay!\": ");
string input = Console.ReadLine();
int counter = 0;
try
{
var total = int.Parse(input);
while(total > counter)
{
counter += 1;
Console.WriteLine("Yay!");
}
}
catch(FormatException)
{
Console.WriteLine("You must enter a whole number");
}
}
}
}