//efek salju

Kamis, 08 November 2012

menghitung Total Pembayaran menggunakan c++


#include "stdio.h"
#include "conio.h"
void main()
{
char kode[20],nama[20];
float jumlah, harga,diskon,harga_diskon;
clrscr();
printf("=======================================\n");
printf("\n Kode Barang : ");
scanf("%s",&kode);
printf("\n Nama Barang : ");
scanf("%s",&nama);
printf("\n Harga : Rp ");
scanf("%f",&harga);
printf("\n Jumlah : ");
scanf("%f",&jumlah);
diskon=0.2*harga;
harga_diskon=harga-diskon;
printf("=======================================\n");
printf(" Kode Barang  = %s\n",kode);
printf(" Nama Barang  = %s\n",nama);
printf(" Harga  = Rp %.2f\n",harga);
printf(" Diskon  = 20\%\n");
printf(" Jumlah  = %.0f\n",jumlah);
printf(" Jumlah harga = Rp %.2f\n",harga_diskon*jumlah);
printf("=======================================\n");
getch();
}