InterviewSolution
Saved Bookmarks
| 1. |
Write an algorithm to input N numbers and find the largest among them. |
|
Answer» The algorithm as : Step 1: Read N. Step 2 : Let ctr = 1. Step 3: Read Num. Step 4 : large = Num. Step 5: Read next Num. Step 6 : ctr = ctr + 1. Step 7 : If (Num > large) then large = Num. Step 8 : If (ctr < = N) then repeat steps 5 and 6. Step 9: Print large. Step 10: End. |
|