#include <stdio.h>
#include <stdlib.h>
int main () {
//deklarasi variable
int uts, uas, tgs;
float na; char grade;
//judul program
printf("Perogram penghitung nilai mahasiswa\n\n");
//input
printf("masukan nilai uts : "); scanf("%d",&uts);
printf("masukan nilai uas : "); scanf("%d",&uas);
printf("masukan nilai tgs : "); scanf("%d",&tgs);
//proses
na=(float)(uts*40+uas*60+tgs*40)/(40+60+40); //menghitung na
if(uas ==0) grade='K'; //menentukan grade
else if (na>=85) grade='A';
else if (na>=70) grade='B';
else if (na>=56) grade='C';
else if (na>=40) grade='D';
else grade='E';
//output
printf("\nNA = (%dx40+%dx60+%dx40)/(40+60+40) = %.3f\n",uts,uas,tgs,na);
printf("grade = %c\n",grade);
printf("\n\n");
system ("pause");
return(0);
}
/*By D-JokerZzZ*/
0 komentar:
Posting Komentar