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

Step 1 : [Assume first element is the largest ] large = A [ 0 ]
Step 2 : POS = 0.
Step 3 : [Find the largest element in the array and its position] For I = 1 to N – 1 
Step 4 : If ( A [ I ] > large ) Then
Step 5 : large = A [ I ]
Step 6 : POS = 1

[ End if ]
[ End of step 3 for loop ]
Step 7: [ Print the largest and its position] Print “ Largest = “ , large , “ 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: