Kamis, 20 Juni 2013

Program Informasi Penjualan Produk Dengan Discount

Berikut ini adalah contoh program mengenai Informasi Penjualan Produk Dengan Discount :

#include "stdio.h"
#include "conio.h"

void main(){
    int i, kode[15], jumlah[15], jumdata=5;
    char*produk;
    float harga, total, disc, bayar;

    printf("\Input Data Penjualan");
    for(i=0;i<jumdata;i++){
        printf ("\nKode Produk :"); scanf("%d",&kode[i]);
        printf ("Jumlah Produk :"); scanf("%d",&jumlah[i]);
    }
    clrscr();
    printf ("\n                        Informasi Penjualan Produk");
    printf ("\n ---------------------------------------------------------------------------");
    printf ("\n No Kode Produk                  Harga  Jumlah   Total    Discount    Bayar");
    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<2000000){
            disc=0.1*total;
        }else if (total<4000000){
            disc=0.15*total;
        }else if (total>4000000){
            disc=0.2*total;
        }else{
            disc=0;
        }
        bayar = 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, bayar);
    }
    printf("\n ---------------------------------------------------------------------------");
}

Hasil tampilan program:

Popular Posts