Professional Documents
Culture Documents
Lab Task 1: The Vector", Where X & y Are The Index of Minimum and Maximum Value
Lab Task 1: The Vector", Where X & y Are The Index of Minimum and Maximum Value
i) write a function “sum m_to_n” using for loop that calculate the sum of
integers from m to n prompted by user. Display it as: m=5, n=8, Result is
5+6+7+8=26. You cannot use built in function “sum”.
ii) write a function “min_max_val” to find the minimum & maximum value in a
vector prompted by user. You can only use “if” & “for”. Output should be as:
“The minimum so far is the x element in the vector & maximum is y element in
the vector”, where x & y are the index of minimum and maximum value
respectively.
NOTE: you can’t use built in function “min” or “max”
Lab Task 2:
i) Use “Nested loops” to create a multiplication table of the form given
below. You can’t use built in function “multtable”.