Question

Prepare pseudocode for a program that lets a user continuously enter numbers until the number 99...

Prepare pseudocode for a program that lets a user continuously enter numbers until the number 99 is entered. Once the user has stopped entering numbers, display the number of numbers entered AND the sum of those numbers. You'll need a counter and an accumulator for this (see pp. 179-181 and 205-208). Make sure your loop is structured (see priming input in figure 3-16). Don't forget to comment your code. Don't forget to display appropriate prompts when requesting input from the user. Use a NAMED CONSTANT for the constant in this problem (no magic numbers).

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1) Start the program

2) Declare a sum variable,

3) Declare an integer list to store numbers

4) Use an infinite for loop

5) Inside the for loop get the user input evaluate to 99 if fails prints the list and sum value.

6) If above condition become true stores the value in the list and loops again for the other number.

7) Stop the program.

For example:

static void Main(string[] args)
{
List<int> list = new List<int>();
int sum = 0;
for(;;)
{
Console.WriteLine("Enter a number ");
int number = Convert.ToInt16(Console.ReadLine());
if(number!=99)
{
list.Add(number);
sum = sum + number;
}   
else{

for (int i = 0; i < list.Count;i++ )
{
Console.WriteLine(list[i]);

}

Console.WriteLine(sum);

break;
}

}
}

Please rate it if the above solution helps you in any way or if you have any concerns comment it, I will help you through again.

Add a comment
Know the answer?
Add Answer to:
Prepare pseudocode for a program that lets a user continuously enter numbers until the number 99...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT