TUGAS ALGORITMA

Sunday, October 16, 2011

GALVANO AKBAR . ZM
12110156


//CREATED BY GALVANO AKBAR . ZM//

#include < stdio.h >
#include < conio.h >

void main()

{
char nm_siswa[30];
int pt1, pt2, pt3, rt2;

clrscr();
printf("\t\tPROGRAM HITUNG NILAI RATA-RATA\n\n");
printf("Nama Siswa\t\t : ");
scanf("%s", nm_siswa);
printf("Nilai Pertandingan I\t : ");
scanf("%d", &pt1);
printf("Nilai Pertandingan II\t : ");
scanf("%d", &pt2);
printf("Nilai Pertandingan III\t : ");
scanf("%d", &pt3);

fflush(stdin);

clrscr();

rt2=(pt1+pt2+pt3)/3;

printf("Siswa yang bernama : %s \n", nm_siswa);
printf("Mendapatkan nilai rata-rata : %d \n", rt2);

if(rt2>=85){printf("Mendapatkan Hadiah Komputer P4\n");}
else if(rt2>=70){printf("Mendapatkan Hadiah 500000\n");}
else if(rt2<70){printf("Mendapatkan Hadiah Hiburan");}

getch();
}
//CREATED BY GALVANO AKBAR . ZM//