Find largest number in an array
Largest number means the greatest number comparison to the other number in the array element.
Example: Suppose we take the 10 arrays element, which is given below:
Array location: a[0] a[1] a[2] a[3] a[4] a[5] a[6] a[7] a[8] a[9]
Element: 1 4 6 4 8 9 6 76 45 23
Largest Number in an Array: 76
Algorithm:
Step 1: Start
Step 2: Take the value of element in an array.
Step 3: Set temporary variable and assign the value of first element to temp.
Step 4: Compare the value of temp with the next element of the array.
Step 5: If the element is having greater value than temp variable, assign that value in temp.
Step 6: Repeat step 4 and step 5 till end of the array is encountered.
Step 7: Print the largest value of temp variable.
Step 8: Stop.