Thursday, January 19, 2012

Penjumlahan Harga Barang (Borland C++)

/*
#----------------------------
# Penjumlahan Harga Barang
#----------------------------
Ket :
nb = Nama Barang  jb = Jumlah Barang
kb = Kode Barang  th = Total Harga
hb = Harga Barang

Total harga :
Harga barang X Jumlah barang

*/
#include<stdio.h>
#include<conio.h>
void main()
{
long int hb,jb,th;
char nb[50];
char kb[50];
printf("Input Nama Barang : ");scanf("%s",&nb);
printf("Input Kode Barang : ");scanf("%s",&kb);
printf("Input Harga Barang : ");scanf("%ld",&hb);
printf("Input Jumlah Barang : ");scanf("%ld",&jb);
th=hb*jb;
printf("Totap Harga : %ld",th);
getch();
}

Penjumlahan Harga Barang Part II
 
/*
#-----------------------------------
# Penjumlahan Harga Barang Part II
#-----------------------------------

Ket :
nb = Nama Barang  jb = Jumlah Barang uk = Uang Kembalian
kb = kode barang  ju = Jumlah Uang
hb = Harga barang  th = Total harga

Total Harga :
Harga barang X Jumlah barang

Kembalian :
Jumlah uang X Harga barang

Jika Harga lebih besar sama dengan Rp.50.000 Bonus Sandal
Jika Harga lebih besar sama dengan Rp.35.000 Bonus Snack
Jika Harga lebih besar sama dengan Rp.20.000 Tidak dapat bonus

*/
#include<stdio.h>
#include<conio.h>
void main()
{
long int hb,jb,ju,th,uk;
char nb[50];
char kb[50];
printf("Input Nama Barang : ");scanf("%s",&nb);
printf("Input Kode Barang : ");scanf("%s",&kb);
printf("Input Harga Barang : ");scanf("%ld",&hb);
printf("Input Jumlah Barang : ");scanf("%ld",&jb);
printf("Input Jumlah uang : ");scanf("%ld",&ju);
th=hb*jb;
printf("Totap Harga : %ld",th);
uk=ju-hb;
printf("\nKembalian : %ld",uk);
if (th>=50000)
printf("\nBonus Sandal");
else if (th>=35000)
printf("\nBonus Snack");
else if (th>=20000)
printf("\nTidak Dapat Bonus");
else if (th<=20000)
printf("\nTidak Dapat Bonus");
getch();
}

I am a fan of technology and i love coffee. I’m also interested in web programming and networking. below there are some accounts you can follow to contact me.