title: C# While Loop (adding the user input to reach a target)
body: <p>I need to create a program that adding the user input to reach a target, as a result, is just like below.</p>
  
  <p><a href="https://i.stack.imgur.com/6Wqhi.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6Wqhi.jpg" alt="enter image description here"></a></p>
  
  <p>I have to use 'While Loop' for this,
  but it is difficult for me to use while loop...</p>
  
  <p>Here is my code</p>
  
  <pre><code>Console.WriteLine("Enter Target Value: 6");
  
  int total = 0;
  int target = 6;
  int i;
  for (i = 1; i &lt;= 4; i++)
  {
      Console.Write("Enter #{0}:\t", i);
      total += Convert.ToInt32(Console.ReadLine());
  }
  
  while (total == target);
  
  Console.WriteLine("It took {0} inputs to take the sum to\t{1}",i, total);
  Console.ReadLine();
  </code></pre>
  
  <p>Could you please help me to find the problems?</p>