rite algorithm and draw flow charts for the following problems: b) To find minimum number among given 3 numbers
Answers
Answered by
0
Explanation:
The basic logic is something like this… I’ll leave it to you to draw the actual flowchart.
And please note that the following logic works for any number of elements; you would typically use it with an array (a single variable name which contains a list of numbers).
So, here goes.
Use a variable “min”, and set it equal to the first element in the list.
Then, for each of the remaining elements in the list:
Compare its value with variable “min”.
If it is less than variable “min”, set variable “min” equal to that element.
And that’s it. After doing this, variable “min” will contain the smallest element.
Similar questions