Blogger news

Jumat, 14 Oktober 2011

percabangan

#include <conio.h>
#include <iostream.h>
#include <stdio.h>
int nilai;
char bobot;
void main ()
{
cout <<"Masukan Nilai = ";
cin >>nilai;
if (nilai <30)
{
cout << "Bobot = 0"<<endl;
cout << "Nilai = E"<<endl;
}
else
if (nilai <45)
{
cout << "Bobot = 1"<<endl;
cout << "Nilai = D"<<endl;
}
else
if (nilai <55)
{
cout << "Bobot = 2"<<endl;
cout << "Nilai = C"<<endl;
}
else
if (nilai <75)
{
cout << "Bobot = 3"<<endl;
cout << "Nilai = B"<<endl;
}
else
if (nilai <85)
{
cout << "Bobot = 4"<<endl;
cout << "Nilai = A"<<endl;
}
}

Tidak ada komentar:

Posting Komentar

 

cctv