0% found this document useful (0 votes)
23 views3 pages

Include Using

Uploaded by

San Adjie
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views3 pages

Include Using

Uploaded by

San Adjie
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Nama : Rasyid San Adjie

NIM : 180536633069

Tugas Rumah 1
#include <iostream>
using namespace std;
int main()
{
int a = 0, b = 20 , c = 20;
cout << "A B C" << endl;
cout << "_______\n" << endl;
for (int i = 0; i < 21; i++)
{
cout << a << " ";
a++;
cout << b << " ";
b--;
cout << c << endl;
}
}

Tugas Rumah 2
#include <iostream>
using namespace std;
int factorial(int n)
{
if ( n == 0 || n == 1)
return 1;
else
return n * factorial(n-1);
}
int main()
{
int n, r, hasil, z;
cout << "===== RUMUS KOMBINASI =====\n\n";
cout << " n! " << endl;
cout << " _____________ " << endl;
cout << " r! * (n-r)! " << endl << endl;
cout << "Masukkan nilai n : " << endl;
cin >> n;
cout << "Masukkan nilai r : " << endl;
cin >> r;

z = factorial(n) / (factorial(r) * factorial(n-r));


cout << "\nKombinasi : " << z;
}

Tugas Rumah 3
#include <iostream>
using namespace std;
int main()
{
cout << "BANK INDONESIA JAYA" << endl << endl;
int Saldo = 100000, pilih, uangSetor;
string konfirmasi = "Y";
cout << "==================================" << endl;
cout << " Saldo : " << Saldo << endl;
cout << "Menu Transaksi :\n";
cout << "1. Setor Tabungan\n"
"2. Ambil Tabungan\n"
"3. Keluar\n"
"Pilihan Menu Transaksi (1/2/3) : ..." << endl << endl;
cout << "Pilihan : ";
cin >> pilih;
if (pilih == 1)
{
while (konfirmasi == "Y")
{
cout << "\nMasukkan Jumlah Setoran Anda : " <<
endl;
cin >> uangSetor;
Saldo += uangSetor;
cout << endl;
cout << "Transaksi Lagi? (Y/N)" << endl;
cout << "Respon : ";
cin >> konfirmasi;
}
cout << "Uang Anda Sekarang : " << Saldo << endl << endl;
cout << " Terima Kasih " << endl;
cout << "===================================";
}
else if (pilih == 2)
{
while (konfirmasi == "Y"){
cout << "Masukkan Jumlah yang ingin Anda
ambil : " << endl;
cin >> uangSetor;
Saldo -= uangSetor;
if (Saldo < 50000)
{
cout << "\nSaldo anda
kurang, Silahkan coba lagi" << endl;
Saldo += uangSetor;
}
cout << "\nTransaksi Lagi? (Y/N)" << endl;
cout << "Respon : ";
cin >> konfirmasi;}
cout << "\n";
cout << "Uang Anda Sekarang : " << Saldo << endl << endl;
cout << " Terima Kasih " << endl;
cout << "===================================";
}
else
{
cout << "\n";
cout << " Terima Kasih " << endl;
cout <<
"=========================
==========";
}
}

You might also like