title: How to stop C# program loop from automatically storing input from last session?
body: <p>I have a problem with one of the options in my program in which option 1, after adding a new student to the dictionary, the program is supposed to prompt the user for another option again but instead the program automatically stores input of the last integer (marks of the student added) and takes that as input for the next option. This only happens with option 1, the others are fine. Why is it and how can I change it? Thank you!</p>
  
  <p>My code is as below:</p>
  
  <pre><code>static void Main(string[] args)
      {
          //initialize menu
          string Menu = @"1. Add a new student to the dictionary
  2. Display all students in the dictionary
  3. Remove an existing student from the dictionary
  4. Modify an existing student's marks from the dictionary
  0. Quit this program
  ";
  
  
  
          //initialize student list
          Dictionary&lt;string, int&gt; nameList = new Dictionary&lt;string, int&gt;();
          nameList.Add("Cindy", 76);
          nameList.Add("Kevin", 68);
          nameList.Add("Sean", 74);
          nameList.Add("Lucy", 63);
          nameList.Add("Sarah", 89);
          nameList.Add("Melvin", 80);
  
          bool b = true;
  
          while (b == true)
          {
  
  
              Console.Write(Menu);
  
              Console.WriteLine();
  
              //prompt user selection
              Console.Write("Select an option: ");
              int select = Convert.ToInt32(Console.ReadLine());
              Console.WriteLine("Option " + select + " is selected");
              Console.WriteLine();
  
              if (select &gt; 0)
              {
                  switch (select)
                  {
                      case 1:
                          Console.Write("Enter the name of the new student: ");
                          string newName = Console.ReadLine();
                          Console.Write("Enter the marks of " + newName + ": ");
                          int newMark = Convert.ToInt32(Console.Read());
                          nameList.Add(newName,newMark);
  
                          Console.WriteLine(newName + " is added to the list");
                          Console.WriteLine();
                          break;
  
                      case 2:
                          Console.WriteLine("No   Name        Marks");
                          int j = 1;
                          foreach (KeyValuePair&lt;string, int&gt; kvp in nameList)
                          {
  
                              Console.WriteLine(j + "    " + kvp.Key + "        " + kvp.Value);
                              j++;
                          }
                          Console.WriteLine();
                          break;
  
  
                      case 3:
                          Console.Write("Enter the name of the student to be removed: ");
                          string bye = Console.ReadLine();
  
                          nameList.Remove(bye);
                          Console.WriteLine(bye + " has been removed from the list");
                          Console.WriteLine();
                          break;
  
                      case 4:
                          Console.Write("Enter the name of the student to modify marks: ");
                          string change = Console.ReadLine();
                          Console.Write("Enter the new marks for " + change + ": ");
                          int changemark = Convert.ToInt32(Console.ReadLine());
                          nameList[change] = changemark;
                          Console.WriteLine("Marks for " + change + " has been updated to " + changemark);
                          Console.WriteLine();
                          break;
  
                      default:
                          Console.WriteLine("Invalid input!");
                          Console.WriteLine();
                          break;
                  }
  
              }
  
              else if (select == 0)
              {   //case 0:
                  Console.WriteLine("Bye!");
                  Console.ReadLine();
                  return;
              }
          }
  
      }
  </code></pre>
  
  <p>And here is a screenshot of the problem stated above:
  <img src="https://i.stack.imgur.com/1Y93D.jpg" alt="enter image description here"></p>