C program to find the largest element from an array:
Find the largest element from an array using c. In which we take an array with n number of element and find the largest element from this array.
For Example.
there is a list of element : 5, 8, 10, 1, 78
In which the largest element (78) is at 4th index.

ALGORITHM:-

step 1 : Start
step 2 : Take an array and input the size
step 3 : input the element in array from user
step 4 : Assume the starting element in max
step 5 : Compare the max element with all remaining element
step 6 : Exit


PROGRAM CODE:-

#include<stdio.h>
#include<stdio.h>

void main()
{    
    int arr[10], max, size, i, loc=0;
    printf("Enter the size of an array: ");
    scanf("%d", &size);

    //Enter elements in array
    printf("Enter Element in array:")
    for (i = 0; i < size; i++)
    {
        scanf("%d", &arr[i]);
    }
    max = arr[0];
    //Find the maximum element 
    for (i = 0; i < size; i++)
    {
        if (arr[i] > max)
        {
            max  = arr[i];
            loc = i;
        }
    }
    printf("Max element %d found at %d position\n", max, loc);
    getch();
}

OUTPUT:-

Enter the size of an array: 5

Enter Element in array: 
5
9
54
1
58

Max element 58 found at 4 position


C program to find out the maximum element from an array
maximum element in array using c
Find the maximum element and it location using c