Quick actions

cmd+k|ctrl+k

Navigation

Languages

Tugas 2.1

Snippet info

Language

Cpp

Visibility

public

Author

alvianrohmadianwari123

Created

2024-10-19T09:27:15.428067Z

Updated

2024-10-20T12:30:45.328799Z

#include <iostream>
#include <iomanip>

// Nama : Alvian Rohmadi Anwari
// Nim : 3420230007

using namespace std;

int main() {
  double hargaSatuan = 10250.75;
  int jumlahBeli = 6;
  double subtotal = hargaSatuan * jumlahBeli;
  double diskon = subtotal * 0.1; // Diskon 10%
  double total = subtotal - diskon;
cout << "-----------------------------------------------------------------------" << endl;
  cout << "Program Penjualan Marshmallow Plain" << endl;
cout << "-----------------------------------------------------------------------" << endl;
  cout << "Harga Satuan     : Rp " << fixed << setprecision(2) << hargaSatuan << endl;
  cout << "Jumlah Beli      : " << jumlahBeli << endl;
cout << "-----------------------------------------------------------------------" << endl;
  cout << "Subtotal         : Rp " << fixed << setprecision(2) << subtotal << endl;
  cout << "Diskon 10 Persen : Rp " << fixed << setprecision(2) << diskon << endl;
  cout << "Total            : Rp " << fixed << setprecision(2) << total << endl;
cout << "-----------------------------------------------------------------------" << endl;

  return 0;
}
INFO