Ask Question
28 December, 04:43

Design the logic for a program that allows a user to enter 20 numbers, then displays all of the numbers, the largest number, and the smallest.

+5
Answers (1)
  1. 28 December, 08:28
    0
    Logic of the program:

    Step 1: START

    Step 2: Set Integer data type array variable with size 20.

    Step 3: Get input from the user in the array variable.

    Step 4: Print the array variable

    Step 5: Set integer variable "Maximum" in which we store the array index 0

    Step 6: Set integer variable "Minimum" in which we store the array index 0

    Step 7: Again set an integer variable "i" to 0

    Step 8: Set the while loop and pass condition the variable "i" is less than 20

    Step 9: Then, set the if conditional statement and check array[i] is greater than the variable "Maximum" then,

    Step 10: Initialize the value of array[i] in the variable "Maximum" i. e., Maximum = array[i]

    Step 11: Again set the if conditional statement and check array[i] is less than the variable "Minimum" then,

    Step 12: Initialize the value of array[i] in the variable "Minimum" i. e., Minimum = array[i].

    Step 13: END the IF condition.

    Step 14: Increment in the variable "i" by 1 i. e., i = i+1

    Step 15: END the WHILE loop

    Step 16: Print the value of the variable "Maximum"

    Step 17: Print the value of the variable "Minimum"
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Design the logic for a program that allows a user to enter 20 numbers, then displays all of the numbers, the largest number, and the ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers