#include"conio.h"
void main()
{
int i,kode[15],jumlah[15],jumdata=5;
char*produk;
float harga,total,disc,pembayaran;
printf("\nInput Data Penjualan");
for(i=0;i<jumdata;i++){
printf("\nKode Produk :"); scanf("%d",&kode[i]);
printf("\nJumlah Produk :"); scanf("%d",&jumlah[i]);
}
clrscr();
printf("\nInformasi Penjualan Produk");
printf("\n-------------------------------------------------------------------------------");
printf("\nNo Kode Produk Harga Jumlah Total Discount Pembayaran");
printf("\n-------------------------------------------------------------------------------");
for(i=0; i<jumdata; i++){
if(kode[i]==1){
produk="TV"; harga=2000000;
}else if(kode[i]==2){
produk="DVD"; harga=650000;
}else if(kode[i]==3){
produk="CD ROOM"; harga=450000;
}
total=harga*jumlah[i];
if(total> 4000000)disc=0.1*total; else
if(total< 4000000)disc=0;
pembayaran=total-disc;
gotoxy(1,6+i);printf( "%i %d %s ",i+1,kode[i],produk);
gotoxy(30,6+i);printf("%10.0f %i %10.0f%10.0f%10.0f" ,harga,jumlah[i],total,disc,pembayaran);
}
printf("\n--------------------------------------------------------------------------------");
}
hasil printout