Kasus 3.4

Pertanyaan :

Konversikan nilai angka menjadi nilai huruf dengan ketentuan sebagai berikut :

#include <iostream>
#include <string>
using namespace std;
int main(){
   int nilai;
   cout << "Masukkan nilai angka : ";
   cin >> nilai;
   if (nilai>0 && nilai<=20)
   {
      cout << "Nilai huruf = E" << endl;   }
   else
   {
      if (nilai>20 && nilai<=40)
      {
         cout << "Nilai huruf = D" << endl;      }
      else
      {
         if (nilai>40 && nilai<=60)
         {
            cout << "Nilai huruf = C" << endl;         }
         else
         {
            if (nilai>60 && nilai<=80)
            {
               cout << "Nilai huruf = B" << endl;            }
            else
            {
               cout << "Nilai huruf = A" << endl;            }
         }
      }
   }
   return 0;
}


 Raptor :

Share on Google Plus

About Luthfi

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment