#include <stdio.h>
void garis() {
puts("======================================================");
}
void judul() {
garis();
puts("\tContoh Program Array");
garis();
}
void author() {
puts("Nama\t: Nagita Elsa");
puts("Email\t: nagitaelsa39@gmail.com");
}
int main() {
int jml;
judul();
printf("Masukan Jumlah Data\t:\n");
scanf("%d", &jml);
garis();
// Declare static arrays
int absen[jml], tugas[jml], uts[jml], uas[jml];
float total[jml];
for (int i = 0; i < jml; i++) {
printf("Data ke-%d", i + 1);
printf("\nMasukan Nilai Absen\t: ");
scanf("%d", &absen[i]);
printf("\nMasukan Nilai Tugas\t: ");
scanf("%d", &tugas[i]);
printf("\nMasukan Nilai UTS\t: ");
scanf("%d", &uts[i]);
printf("\nMasukan Nilai UAS\t: \n");
scanf("%d", &uas[i]);
garis();
// Calculate total score
total[i] = (absen[i] * 0.1) + (tugas[i] * 0.2) + (uts[i] * 0.3) + (uas[i] * 0.4);
}
puts("Data Yang Anda Masukan");
garis();
printf("No\tAbsen\tTugas\tUTS\tUAS\tTotal\n");
for (int i = 0; i < jml; i++) {
printf("%d\t%d\t%d\t%d\t%d\t%.2f\n", i + 1, absen[i], tugas[i], uts[i], uas[i], total[i]);
}
garis();
author();
return 0;
}