Created
October 17, 2023 08:26
-
-
Save faizul14/4e00d9fb7792dda6cd26dc94df0a5033 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 3. Inisialisasi variabel jumlah = 0 | |
// Untuk setiap nilai i dari 8 sampai 1 dengan langkah -1 | |
// Tambahkan nilai i ke dalam jumlah | |
// Tampilkan jumlah | |
// CODE: | |
#include <iostream> | |
using namespace std; | |
int main() { | |
int jumlah = 0; | |
for (int i = 8; i >= 1; i--) { | |
jumlah += i; | |
} | |
cout << "Jumlah deret 8 adalah: " << jumlah << endl; | |
return 0; | |
} | |
// 4. Inisialisasi variabel N = 3 | |
// Selama N tidak lebih dari 30 | |
// Tampilkan N | |
// Tambahkan 3 ke dalam N | |
// CODE: | |
#include <iostream> | |
using namespace std; | |
int main() { | |
int N = 3; | |
while (N <= 30) { | |
cout << N << " "; | |
N += 3; | |
} | |
cout << endl; | |
return 0; | |
} | |
// 5. CODE: | |
#include<iostream> | |
using namespace std; | |
int main() { | |
string nama = "Muhammad Ibrahim Hadi"; | |
string kelas = "XI TEHNIK INFORMATIKA"; | |
int no_absen = 12; | |
string alamat = "Kota Mataram"; | |
cout << "Masukan Nama: " << nama << endl; | |
cout << "Masukan Kelas: " << kelas << endl; | |
cout << "Masukan No Absen: " << no_absen << endl; | |
cout << "Masukan Alamat: " << alamat << endl; | |
cout << "Nama: " << nama << endl; | |
cout << "Kelas: " << kelas << endl; | |
cout << "No Absen: " << no_absen << endl; | |
cout << "Alamat: " << alamat << endl; | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment