Thursday 18 February 2016

Algorithm to find greatest number from 3 numbers

Algorithm is finite sequence of solution of problem given to programming language.
We can write algorithm in step wise and use our own lanaguge to give step.


Step 1: Input a,b,c

Step 2: Check if a>b is true then goto step 3 otherwise goto step 8

Step 3: Check if a>c is true then goto step 4 otherwise goto step 6

Step 4: Print a is max

Step 5: stop

Step 6: Print c is max

Step 7: stop

Step 8: Check if b>c is true then goto step 9 otherwise goto step 11

Step 9: Print b is max

Step 10: stop

Step 11: Print c is max

Step 12: stop

No comments:

Post a Comment