0% found this document useful (0 votes)
36 views

Struct Char Char Int Int: #Include

This C program defines a struct called mahasiswa to store student name, ID, and score. It then prompts the user to input data for 8 students, storing it in a mahasiswa array. Finally, it prints out each student's information and assigns a letter grade (A-E) based on their score.

Uploaded by

Miranti Purbaya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

Struct Char Char Int Int: #Include

This C program defines a struct called mahasiswa to store student name, ID, and score. It then prompts the user to input data for 8 students, storing it in a mahasiswa array. Finally, it prints out each student's information and assigns a letter grade (A-E) based on their score.

Uploaded by

Miranti Purbaya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

#include <stdio.h>
struct mahasiswa {
char name [20];
char nim [20];
int skor;
} ;
int main() {
system("color A");
printf("\t\t|*******************************|\n");
printf("\t\t|
Program Hitung Nilai
|\n");
printf("\t\t|*******************************|\n");
printf("\t\t|
SITI MIRANTI PURBAYA
|\n");
printf("\t\t|
125090807111013
|\n");
printf("\t\t|*******************************|\n");
struct mahasiswa data[8];
int i;
for (i=0; i < 8; i++) {
printf ("\nname : ");
scanf ("%s",&data[i].name);
printf ("NIM
: ");
scanf ("%s",&data[i].nim);
printf ("skor : ");
scanf ("%d",&data[i].skor);
}
printf ("\n\n==========================");
for (i=0; i < 8; i++) {
printf ("\n%s
%s %d ", data[i].name,data[i].nim,data[i].skor);
if (data[i].skor>=80)
printf ("A");
else if (data[i].skor>=70)
printf ("B");
else if(data[i].skor>=59)
printf ("C");
else if(data[i].skor>=50)
printf ("D");
else
printf ("E");
}
return 0;
}

You might also like