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.

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

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

  • The Problem Design a program that lets the user enter the total rainfall for each of...

    The Problem Design a program that lets the user enter the total rainfall for each of 12 months into an array. The program should calculate and display the total rainfall for the year, the average monthly rainfall, the number of months above and below the average rainfall, and the highest rainfall for each quarter of the year. The Assignment Write a Java program that contains five method/functions as follows: main(). Calls the functions enterRain, rainStats, aboveBelow, and quarterlyRain. enterRain(). Uses...

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

  • please help part one) Calories Burned Running on a particular-treadmill you burn 3.9 calories per minute....

    please help part one) Calories Burned Running on a particular-treadmill you burn 3.9 calories per minute. Design a pro- gram that uses a loop to display the number of calories burned after 10, 15, 20, 25, and 30 minutes. 3 part two) Sum of Numbers Design a program with a loop that asks the user to enter a series of positive num bers. The user should enter a negative number to signal the end of the series. After all the...

  • Write a program that allows the user to enter a series of exam scores. The number...

    Write a program that allows the user to enter a series of exam scores. The number of scores the user can enter is not fixed; they can enter any number of scores they want. The exam scores can be either integers or floats. Then, once the user has entered all the scores they want, your program will calculate and print the average of those scores. After printing the average, the program should terminate. You need to use a while loop...

  • Design a program that lets the user enter the total rainfall for each of 12 months...

    Design a program that lets the user enter the total rainfall for each of 12 months into an array. The program should calculate and display the total rainfall for the year, the average monthly rainfall, and the months with the highest and lowest amount. PLEASE MODULARIZED THE CODE   PLEASE USE C PROGRAMMING AND ADD PSEUDOCODE

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