Selasa, 08 Maret 2016

Contoh Penggunaan IF Else

#include <iostream>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */


using namespace std;
int main(int argc, char** argv) {
    {int nilai;
    cout<<"nilai :";
    cin>>nilai;
    if (nilai<40)cout<<"D";
    else if(nilai<=60)cout<<"C";
    else if(nilai<80)cout<<"B";
    else cout<<"A";
    }
    return 0;
}

Tidak ada komentar:

Posting Komentar