Sabtu, 16 April 2016

How To Solve 4.2

1.Algoritma :
   Deklarasi banyak,i,x
array int nilai [20]
deklarasi string nama

inputkan banyak mahasiswa
for (int i=1;i<=banyak;i++){
input nama;
input nilai mahasiswa i
if (nilai[20]>=80 || nilai[20]<=100)
ceta nilai = A
else if (nilai[20]>=60 || nilai[20]<80)
cetak nilai = B
else if (nilai[20]>=40 || nilai[20]<60)
cetak nilai = C
else if (nilai[20]>=20 || nilai[20]<40)
cetak nilai = D
else if (nilai[20]>=0 || nilai[20]<20)
cetak nilai = E
end for

2.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;
}


luvne.com ayeey.com cicicookies.com mbepp.com kumpulanrumusnya.com.com tipscantiknya.com

1 komentar:

  1. 888 Casino Online PA | Play Slots, Blackjack, Roulette
    888 Casino online 서울특별 출장마사지 features the best slots, 거제 출장안마 blackjack, roulette and many more. Check 여수 출장안마 out 충주 출장마사지 the 888 Casino online 서귀포 출장샵 casino and play your favorite

    BalasHapus