#include <stdio.h>
int masukan(int n);
int average(int total, int n);

void main() {
    int n;
    
    printf("Masukkan jumlah data: ");
    scanf("%d", &n);

    int total = masukan(n);
    int rataRata = average(total, n);

    printf("Rata rata: %d", rataRata);
}

int masukan(int n) {
    int total = 0;

    for (int i = 0; i < n; i++) {
        int temporary;
    
        printf("Masukkan data ke - %d: ", i + 1);
        scanf("%d", &temporary);

        total += temporary;
    }

    return total;
}

int average(int total, int n) {
    return total / n;
}

Embed on website

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