Write a program to find out largest element of an array

Write a program to find out largest element of an array

// Write a program to find out largest element of an array
// Ex: [4,6,3,9,5,3,5] -> 9
#include
int main(){
    int len,max,i=0;
    printf(“Enter length of an array:”);
    scanf(“%d”,&len);                 // array length input from user
    int array[len];
    // user input for matrix1 elements
    printf(“Enter Matrix1 Elements”);
    for(i=0;i<len;i++){
scanf(“%d”,&array[i]);
}
    // largest element of an array
    max = array[0];
    for(i=1;i<len;i++){ if(array[i]>max){
max = array[i];
        }
    }
    // printing largest element
    printf(“Largest Element of an Array: %d”,max);
}