Ask Question
21 March, 06:34

What is the purpose of the following algorithm? input somenum Repeat the following steps for 14 times input variable1 if variable1 < somenum then somenum = variable1 print somenum

+4
Answers (1)
  1. 21 March, 07:40
    0
    The purpose of the algorithm is to print the least digit among a total of 15 digita

    Explanation:

    input somenum

    Repeat the following steps for 14 times

    input variable1

    if variable1 < somenum then

    somenum = variable1

    print somenum

    On line 1, the algorithm takes an input through variable1

    An iteration is started on line 2 and ends on line 6

    Line 3,4,5 re performed repeatedly;

    On line 3, the algorithm accepts another input through somenum and it keep accepting it till the end of the iteration.

    On line 4, the algorithm tests if variable1 is lesser than somenum.

    If yes, line 5 is executed and the value of variable1 is assigned to somenum

    Else, line 5 is skipped; the iteration moves to line 3 as long as the condition is still valid.

    At the end of the iteration, the least value stored in somenum is printed through
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “What is the purpose of the following algorithm? input somenum Repeat the following steps for 14 times input variable1 if variable1 < ...” in 📙 Engineering if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers