Home » » Contoh Program C++ If,Else If,Elese If

Contoh Program C++ If,Else If,Elese If

#include <iostream>

using namespace std;

int main()
{
    char nama [25];
    char huruf;
    char kelas;
    int nilai;

    cout << "Masukkan nama=";
    cin>>nama;
    cout<<"masukkan kelas=";
    cin>>kelas;
    cout<<"masukkan nilai=";
    cin>>nilai;
    if(nilai>=45 && nilai<55)

         huruf='e';

    else if (nilai>=55 && nilai<65)

         huruf='d';
    else if (nilai>=65 && nilai<75)

         huruf='c';
    else if (nilai>=75 && nilai<85)

         huruf='b';

    else
        huruf='a';
cout<<huruf;


    return 0;
}

0 komentar:

Posting Komentar

Calander

Powered by Calendar Labs
Diberdayakan oleh Blogger.