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 Wrap Up

Ankit Biswas
Ankit Biswas
280 Points

Average Problem

using System; namespace jenzabar.Average { class Progam { static void Main() {

//PROMPT USER FOR A VALUE.
 Console.WriteLine("Please enter your name!");
 string userName = Console.ReadLine();
 Console.WriteLine("Wellcome " + userName + "!");
 while(true)
 {
 double numbertotal = 0;
 int numbers = 0;
 Console.Write("Please enter a value or enter \"done\" to exit: ");
 string userInput = Console.ReadLine();

 if (userInput.toLower() == "done")
 {
    break;
 } else {
  try 
  {
    numbertotal += double.Parse(userInput); // Removed var keyword
     numbers++;
  } catch(FormatException){
   Console.WriteLine("This number is Not valid. Please try again!");
    continue;
  }
 }
  Console.WriteLine("The average of the values is: " + numbertotal / numbers);
}

} } } why I get this error ?? error CS2001: Source file `Program.
cs' could not be found
Compilation failed: 1 error(s), 0 w arnings

Steven Parker
Steven Parker
230,248 Points

This appears to be a duplicate of your previous question.

But to facilitate analysis, make a snapshot (note: not "screenshot") of your workspace and post the link to it here.