- #include<iostream.h>
- #include<conio.h>
- void main()
- {
- clrscr();
- int tugas,uts,uas,rata;
- char* nilai_huruf;
- char* ket;
- cout<<"Masukkan nilai Tugas : ";
- cin>>tugas;
- cout<<"Masukkan nilai UTS : ";
- cin>>uts;
- cout<<"Masukkan nilai UAS : ";
- cin>>uas;
- rata=(tugas+uts+uas)/3;
- if((rata>=90) && (rata<=100))
- {
- nilai_huruf="A (Baik sekali)";
- ket="Lulus";
- }
- else if((rata>=85) && (rata<=89))
- {
- nilai_huruf="B (Baik)";
- ket="Lulus";
- }
- else if((rata>=80) && (rata<=84))
- {
- nilai_huruf="C (Cukup)";
- ket="Lulus";
- }
- else if((rata>=70) && (rata<=79))
- {
- nilai_huruf="D (Kurang)";
- ket="Tidak lulus";
- }
- else
- {
- nilai_huruf="E (Kurang sekali)";
- ket="Tidak lulus";
- }
- cout<<"Nilai anda ="<<nilai_huruf<<endl;
- cout<<"Keputusan = "<<ket<<endl;
- getch();
- }
Tuesday, 18 November 2014
Contoh Program If else if #2
Labels:
Percabangan
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment