C# C# Basics Perfect Final

Milosz Drozd
Milosz Drozd
1,866 Points

I am lost a bit. every advise will be appreciated. Merry Christmas everyone.

stuck here

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 count = int.Parse(input);





            if (input => 0)
            {
                try 
                {

                while(i < count)
                {
                i += 1;   
                Console.WriteLine("Yay!");
                }
                }
                catch(FormatException)
                {
                Console.WriteLine("You must enter a whole number.");
                }    
            }   
                else

                {
                 Console.WriteLine("You must enter a positive number.");
                }

         }   
    }
}

1 Answer

Barry Snowe
Barry Snowe
45,097 Points

The challenge did say to wrap ALL the code in the Main method in the try catch block. Maybe try that and see if it passes.