Prime b

Prime b

  • NA
  • 810
  • 338.9k

Need help with loops

Jan 2 2012 10:33 PM
This is the problem:
Write a console-based application that allows the user to
enter any number of integer values continuously (in any
order) until the user enters 999. Display the sum of the values
entered, not including 999.

This is what I have done
            int number = 1;
            double sum;
                const int LIMIT = 999;
            while( number < LIMIT )
            {
                Console.WriteLine("{0}", number);
                number += 1;
             }

My question is  how can i display the sum of the values entered?

Answers (3)