#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <iostream>
using namespace std;
int main()
{
char kb, nb;
int stuan, jb, tb, hb;
float th, pot,tot;
printf("--------------------------------------------------------------\n");
printf("\t \t MINI MARKET SERBA ADA \n");
printf("--------------------------------------------------------------\n");
//input
printf("Kode Barang \t : ");scanf("%s",&kb);
printf("Nama Barang \t : ");scanf("%s",&nb);
printf("Satuan \t \t : ");scanf("%i",&stuan);fflush(stdin);
printf("Jumlah Beli \t : ");scanf("%10.i",&jb);fflush(stdin);
printf("Harga Beli \t : ");scanf("%i",&hb);fflush(stdin);
printf("--------------------------------------------------------------\n");
th = jb * (float)hb;
printf("Total Harga \t : Rp. %10.2f \n ",th);
if(th > 100000)
{
pot =0.1*th;
}
else
{
pot=0;
}
printf("Potongan \t : Rp. %10.2f \n ",pot);
printf("--------------------------------------------------------------\n");
tot = th-pot;
printf ("Total Bayar \t : Rp. %10.2f \n ",tot);
printf("--------------------------------------------------------------\n");
getch();
return 0;
}
Read more ...
#include <stdlib.h>
#include <conio.h>
#include <iostream>
using namespace std;
int main()
{
char kb, nb;
int stuan, jb, tb, hb;
float th, pot,tot;
printf("--------------------------------------------------------------\n");
printf("\t \t MINI MARKET SERBA ADA \n");
printf("--------------------------------------------------------------\n");
//input
printf("Kode Barang \t : ");scanf("%s",&kb);
printf("Nama Barang \t : ");scanf("%s",&nb);
printf("Satuan \t \t : ");scanf("%i",&stuan);fflush(stdin);
printf("Jumlah Beli \t : ");scanf("%10.i",&jb);fflush(stdin);
printf("Harga Beli \t : ");scanf("%i",&hb);fflush(stdin);
printf("--------------------------------------------------------------\n");
th = jb * (float)hb;
printf("Total Harga \t : Rp. %10.2f \n ",th);
if(th > 100000)
{
pot =0.1*th;
}
else
{
pot=0;
}
printf("Potongan \t : Rp. %10.2f \n ",pot);
printf("--------------------------------------------------------------\n");
tot = th-pot;
printf ("Total Bayar \t : Rp. %10.2f \n ",tot);
printf("--------------------------------------------------------------\n");
getch();
return 0;
}