Advertisement
0xCor3

Logic

Oct 3rd, 2019
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.28 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6.     int UTS, UAS, TUGAS;
  7.     string NILAI_UTS, NILAI_UAS, NILAI_TUGAS;
  8.     cout << "Nilai UTS : "; cin >> UTS;
  9.     cout << "Nilai UAS : "; cin >> UAS;
  10.     cout << "Nilai Tugas : "; cin >> TUGAS;
  11.     if(UTS == 0 || UAS == 0 || TUGAS == 0){
  12.         cout << "Nilai UTS : E, Nilai UAS : E, Nilai Tugas : E" << endl;
  13.     }else{
  14.         if(UTS >= 75 && UTS <= 100){
  15.             NILAI_UTS = "A";
  16.         }else if(UTS >= 60 && UTS<= 75){
  17.             NILAI_UTS = "B";
  18.         }else if(UTS >= 40 && UTS<= 60){
  19.             NILAI_UTS = "C";
  20.         }else if(UTS >= 20 && UTS<= 40){
  21.             NILAI_UTS = "D";
  22.         }else{
  23.             NILAI_UTS = "E";
  24.         }
  25.         if(UAS >= 75 && UAS <= 100){
  26.             NILAI_UAS = "A";
  27.         }else if(UAS >= 60 && UAS <= 75){
  28.             NILAI_UAS = "B";
  29.         }else if(UAS >= 40 && UAS <= 60){
  30.             NILAI_UAS = "C";
  31.         }else if(UAS >= 20 && UAS <= 40){
  32.             NILAI_UAS = "D";
  33.         }else{
  34.             NILAI_UAS = "E";
  35.         }
  36.         if(TUGAS >= 75 && TUGAS <= 100){
  37.             NILAI_TUGAS = "A";
  38.         }else if(TUGAS >= 60 && TUGAS <= 75){
  39.             NILAI_TUGAS = "B";
  40.         }else if(TUGAS >= 40 && TUGAS <= 60){
  41.             NILAI_TUGAS = "C";
  42.         }else if(TUGAS >= 20 && TUGAS <= 40){
  43.             NILAI_TUGAS = "D";
  44.         }else{
  45.             NILAI_TUGAS = "E";
  46.         }
  47.         cout << "Nilai UTS : " << NILAI_UTS << ", Nilai UAS : " << NILAI_UAS << ", Nilai Tugas : " << NILAI_TUGAS << endl;
  48.     }
  49.     return 0;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement