#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define SIZE 5

void init(int a[]){
    for(int i=0;i<SIZE;i++){
        a[i]= rand();
    }
}

void print(int b[]){
    for(int i=0;i<SIZE;i++){
        printf("%d[%d]\n", b[i], i);
    }
    
}

int findLargest(int arr[]){
    int large = arr[0];
    for(int i=0;i<5;i++){
    if (arr[i] > large){
        large = arr[i];
    }
    }
    return large;
}


int main() {
    srand(time(NULL));
    int arr[SIZE] = {0,};
    
    init(arr);
    print(arr);
  
    int largest = findLargest(arr);
    printf("largest: %d\n", largest);

    return 0;
}


Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: