1. Engineering
  2. Computer Science
  3. 10 write a program that uses a loop to find...

Question: 10 write a program that uses a loop to find...

Question details

10. Write a program that uses a loop to find the minimum of a vector x, without using any predefined functions like min(...) or sort(...). You will need to define a variable, x.min say, in which to keep the small- est value you have yet seen. Start by assigning x.min <-x[1] then use a for loop to compare x.min with x[2], x[3], etc. If/when you find x[ǐ] < x.min. update the value of х.min accordingly.

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution