Ask Question
21 December, 04:09

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

+1
Answers (1)
  1. 21 December, 04:23
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers