Rabu, 12 Juni 2013

Informasi Penjualan Produk

Tugas Informasi Penjualan Produk

#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 ---------------------------------------------------------------------------");
}

Tampilan Program :

Minggu, 02 Juni 2013

Yuk! Belajar Konsep Pemrograman Di Mesran.Blogspot.Com


Berikut Jawaban Program :

#include "iostream.h"
#include "conio.h"

void main()
{
     int i,masukkan,hasil=1;
     clrscr();
        cout<<"Input Nilai : "; cin>>masukkan;
     for (i=1;i<=masukkan;i++)
     {
     if (i==masukkan)
        cout<<i;
     else
        cout<<i<<"*";
        hasil=hasil*i;
     }
     cout<<"="<<hasil;
}

Tampilan Hasil Program :


Demikilahlah postingan saya
 Nama : Novi Setiawati
     NPM  : 12110599
 Selamat Belajar Bahasa Pemrograman