Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- double nilai_kuis, nilai_UAS, nilai_tugas, nilai_akhir,bobot;
- char nilai_huruf;
- cout << "Masukkan nilai kuis: ";
- cin >> nilai_kuis;
- cout << "Masukkan nilai UAS: ";
- cin >> nilai_UAS;
- cout << "Masukkan nilai tugas: ";
- cin >> nilai_tugas;
- if (nilai_UAS>=nilai_kuis){
- nilai_akhir = 0.3 * nilai_kuis + 0.5 * nilai_UAS + 0.2 * nilai_tugas;
- }
- else {
- nilai_akhir = 0.4 * nilai_kuis + 0.4 * nilai_UAS + 0.2 * nilai_tugas;
- }
- if (nilai_akhir >= 85) {
- nilai_huruf = 'A';
- bobot=4;
- } else if (nilai_akhir >= 75) {
- nilai_huruf = 'B';
- bobot=3;
- } else if (nilai_akhir >= 65) {
- nilai_huruf = 'C';
- bobot=2;
- } else if (nilai_akhir >= 50) {
- nilai_huruf = 'D';
- bobot=1;
- } else {
- nilai_huruf = 'E';
- bobot=0;
- }
- cout << "Nilai akhir: " << nilai_akhir << endl;
- cout << "Nilai huruf: " << nilai_huruf << endl;
- cout << "Bobot: " << bobot << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement