Write an algorithm to find the maximum element in the given array.

Step 1 : [Assume 1st element is the smallest] small = A [ 0 ]
Step 2 : POS = 0
Step 3 : [ Find the smallest element in the array and its position] For I = 1 to N – 1 Do

Step 4 : If ( A [ I ] < small ) Then
Step 5 : small = A [ I ]
Step 6 : POS = 1
[ End if ]
[ End of step 3 for loop ]
Step 7: [ Print the smallest and its position]
Print “ Smallest element = “ , small , “ position = “ , POS.
Step 8: Exit.


Thanks
Mukesh Rajput
Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: