Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C# C# Basics (Retired) Perfect Final

Ryan Hargreaves
Ryan Hargreaves
2,060 Points

Hi guys, really struggling with this, any help?

It says i have to create a program which basically prints the word "yay!" the amount of times of whatever number the user puts. thanks. any help?

Program.cs
using System;

namespace Treehouse.CodeChallenges
{
    class Program
    {
        static void Main()
        {
            Console.Write("Enter the number of times to print \"Yay!\": ");

        }
    }
}

1 Answer

Robert Stefanic
Robert Stefanic
35,170 Points

Think about what you need to do for this challenge.

They've done part of it for you (they've prompted the user).

I'll lay out the following steps for you:

  1. Get the user's input.
  2. Convert their input from a string to an int.
  3. Use a loop to print "Yay!" however many times the user has requested.