Computer Science, asked by srilalithl4465, 1 year ago

Write a algorithm to find a minimum number in the given list of numbers

Answers

Answered by malathipremi
8

Algorithm: find the Smallest

Input: integer Array list [ ] of N positive integers

Output: the Smallest number in list [ ]

Process:

smallest list [0]

count 1

while (count < size of list)

If (list [count] < smallest) then

smallest list [count]

End if

count count + 1

End while

return smallest

Answered by steffiaspinno
5

list1 = []  

num = int(input("Enter number of elements in list: "))

for i in range(1, num + 1):

ele= int(input("Enter elements: "))

list1.append(ele)  

print("Smallest element is:", min(list1))

  1. Make a single variable to keep track of the minimum value.
  2. To your minimal variables, set the value of the first array element.
  3. Go through the array one by one.
  4. If the present value is less than the minimum on each iteration, apply the present value to the minimum variable.
  5. Your minimal variable will contain the array minimum value after iterating over all N array elements.
Similar questions