Assalamualikum w.w,
4.2 How To Solve
Program mengunakan Dev C++:
#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 banyak, i,x;
int nilai[20];
string nama;
cout<<"Masukan Banyak Mahasiswa :"; cin>>banyak;
for (int i=1;i<=banyak;i++){
cout<<"nama Mahasiswa :";cin>>nama;
cout<<"Masukan nilai :";cin>>nilai[20];
if (nilai[20]>=80 || nilai[20]<=100){
cout<<"\n Nilai "<<nilai[20]<<"Adalah A";
}
else if (nilai[20]>=60 || nilai[20]<80){
cout<<"\n Nilai "<<nilai[20]<<"Adalah B";
}
else if (nilai[20]>=40 || nilai[20]<60){
cout<<"\n Nilai "<<nilai[20]<<"Adalah C";
}
else if (nilai[20]>=20 || nilai[20]<40){
cout<<"\n Nilai "<<nilai[20]<<"Adalah D";
}
else if (nilai[20]>=0 || nilai[20]<20){
cout<<"\n Nilai "<<nilai[20]<<"Adalah E";
}
cout<<"\n========================================================================\n";
}
return 0;
}
Gambar program nya:
Gambar output nya:
Alhamdulillah
Selamat mencoba dan semoga bermanfaat :)
Waalaikumsalam w.w.
0 komentar:
Posting Komentar