154,882 views
4 votes
4 votes
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

User Dave Doga Oz
by
3.3k points

1 Answer

4 votes
4 votes

Answer:

The purpose of the algorithm is to print the least digit among a total of 15 digita

Step-by-step 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

User Abhishek Menon
by
3.0k points