Programming Fundamentals

Exercise 2

Problem: Find minimum of three numbers

To find minimum of three numbers, first  two number are compared to find smaller of first  two numbers. The result of this comparison is compared with third number to find smaller of three number 

Algorithm:

            1. REM This algorithm finds minimum of three numbers
            2. Input n1,n2,n3
            3. If n1 < n2 , goto 9
            4. If n2 < n1 , goto 7
            5. Print n3
            6. Goto 13
            7. Print n2
            8. Goto 13
            9. If n1 < n3 , goto  12
            10. Print n3
            11. Goto 13
            12. Print n1
            13. STOP

Flowchart