Question

2) Largest and Smallest Design a program with a loop that lets the user enter a series of numbers. The user should enter-99-99 to signal the end of the series. After all the numbers have been entered, the program should display the largest and smallest numbers entered. a) Use a Do-Until Loop

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

Here is code:

Public Module Program
Public Sub Main(args() As string)
Dim input As Integer = 1
Dim max As Integer
Dim min As Integer
Dim count As Integer = 0
Do Until input = -99 'Condition is False.Hence loop will be executed
Console.WriteLine("Enter number -99 to quit : ")
input = CInt(Console.ReadLine())
If input <> -99 Then
If count = 0 Then
max = input
min = input
count = count + 1
Else
If max < input Then
max = input
End If
If min > input Then
min = input
End If
End If
End If
Loop
Console.WriteLine("The Maximun number is : " & max)
Console.WriteLine("The Minimun number is : " & min)
End Sub
End Module

Output:

Enter number -99 to quit : 5
Enter number -99 to quit : 5
Enter number -99 to quit : 6
Enter number -99 to quit : 9
Enter number -99 to quit : -5
Enter number -99 to quit : 8
Enter number -99 to quit : -99
The Maximun number is  : 9
The Minimun number is  : -5
Add a comment
Know the answer?
Add Answer to:
2) Largest and Smallest Design a program with a loop that lets the user enter a...
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
  • I need to write a program in C that covers this: I need in c language...

    I need to write a program in C that covers this: I need in c language Design a program with a loop that lets the user enter a series of numbers the user should enter -99 to signal the end of the series. after all the numbers have been entered, the program should display the largest and smallest numbers entered.

  • Write a program that lets the user enter 10 values into an array. The program should...

    Write a program that lets the user enter 10 values into an array. The program should then display the largest and the smallest values stored in the array. The program should display the following message to the user at the beginning "This program will ask you to enter ten values. Then it will determine the largest and smallest of the values you entered.Please enter 10 integers separated by spaces: " And then after user entered the numbers, it should display...

  • Use an end of file controlled loop, at keyboard, that lets the user enter a series...

    Use an end of file controlled loop, at keyboard, that lets the user enter a series of integers. The user should enter Ctrlz to stop or signal the end of the series of numbers. Display the count of numbers below 200

  • In C++ 2. Write a program that allows the user to enter a series of positive...

    In C++ 2. Write a program that allows the user to enter a series of positive numbers between 1 and 100 and displays the smallest and largest of the numbers entered. The program should not store the numbers that were entered, only keep track of the smallest and largest ones. The program should continue accepting numbers until the value 0 is entered and then display the results. If a number out of range is entered, tell the user it is...

  • In Java, write a program using a loop that asks the user to enter a series...

    In Java, write a program using a loop that asks the user to enter a series of decimal numbers. The user must enter -88 to end the input of the decimal numbers. After the user enters all numbers, the program should display the sum of all numbers entered.

  • 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 . Make sure your loop is structured 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...

  • 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...

  • Write a program that lets the user enter at least 10 values into an array. The...

    Write a program that lets the user enter at least 10 values into an array. The program should then display the largest and smallest values stored in the array. Do it in C++

  • Write a program that lets the user enter at least 10 values into an array. The...

    Write a program that lets the user enter at least 10 values into an array. The program should then display the largest and smallest values stored in the array. Do it in C++

  • In C++ Write a program that lets the user enter at least 10 values into an...

    In C++ Write a program that lets the user enter at least 10 values into an array. The program then display the largest and smallest values stored in the array.

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