Anda di halaman 1dari 2

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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66

#include <stdio.h>
#include <stdlib.h>
/**
* PascaP02_2015630015_260216_02.c
*
* Created On : Februrary 26, 2016
* Author : Felix Saputra G-2015630015
* @file P02_2015630015_260216_02.c
* @author Felix Saputra G-2015630015
* @brief Menghitung nilai mahasiswa Dengan index nilai
*/
int main()
{
int npm;
printf("Hello Mahasiswa Bagaimana Nilai Anda \n");
printf("Masukkan NPM Anda : \n");
scanf("%i",&npm);
//deklarasi variable//
float absen,tugas,mid,uas,na;
int nilai;
char *ket,*ket2;
printf("input nilai kehadiran: \n");
scanf("%f",&absen);
printf("input nilai tugas:\n");
scanf("%f",&tugas);
printf("input nilai mid:\n");
scanf("%f",&mid);
printf("input nilai uas:\n");
scanf("%f",&uas);
na=0.1*absen+0.2*tugas+0.3*mid+0.4*uas;
printf("nilai akhir = %f \n",na);

///proses pengkondisian
if (na >= 91)
{
ket = "A";
ket2 = "Nilai Nya A";
}
else if (na >=86 && na <=90)
{
ket = "A-";
ket2 = "Nilainya A-";
}
else if (na >=76 && na <=86 )
{
ket = "B";
ket2 = "Nilainya B";
}
else if (na >=66 && na <=75 )
{
ket = "B-";
ket2 = "Nilainya B-";
}
else if (na >=56 && na <=65)
{
ket = "C";
ket2 = "Nilainya C";
}
else if (na >=45 && na <=55)
{

67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84

ket = "D";
ket2 = "Nilainya D";
}
else if (na == 0 && na <55)
{
ket = "E";
ket2 ="Anda Harus Mengulang Mata Kuliah";
}
//tampilkan output
printf("Keterangan : %s \n",ket);
printf("Penilaian : %s \n",ket2);
return main ();
}