C# C# Basics (Retired) Perfect Final

Sarachoudry@yahoo.com Choudry
Sarachoudry@yahoo.com Choudry
7,081 Points

what am I missing?

please help

Program.cs
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
MOD
Gabriel Pierce-Lackey
Treehouse Moderator 10,972 Points

You 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");
             }
        }

    }
}