Loading presentation...

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

PROGRAM KASIR MENGGUNAKAN BAHASA C

No description
by

Hendra Sukma

on 26 December 2013

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of PROGRAM KASIR MENGGUNAKAN BAHASA C

PROGRAM APLIKASI KASIR MENGGUNAKAN BAHASA C
INTRODUCE
SOURCE CODE
#include <stdio.h>
#include <stdlib.h>

int main()
{
char nam[15][15];
float harga[15],diskon[10],total[10],tot,kembali[15],uag;
int a,bnyk,jmlh[15];

printf("=============================================================\n");
printf("\t\t\t TOKO HENDRA SUKMA \n");
printf("=============================================================\n");

Variabel dan Tipe Data
char nam[15][15];
float harga[15],diskon[10],total[10],tot,kembali[15],uag;
int a,bnyk,jmlh[15];
LOOPING
printf("Masukan jumlah barang yang dibeli : "); scanf("%d",&bnyk);
printf("=============================================================\n");
for(a=0;a<bnyk;a++)
{
printf("Masukan Nama Barang : ");
scanf("%s",&nam[a]);
printf("Harga Barang : ");
scanf("%f",&harga[a]);
printf("Jumlah Barang : ");
scanf("%d",&jmlh[a]);
if(jmlh[a]>=5,jmlh[a]<=8)
diskon[a]= 0.5*(jmlh[a]*harga[a]);
else
diskon[a]=0;
printf("Diskon : %.0f\n",diskon[a]);
total[a]=(harga[a]*jmlh[a])-diskon[a];
printf("Total Harga Barang yang dibeli : Rp. %.0f\n",total[a]);
printf("_____________________________________________________________\n");
tot=tot+total[a];
printf("\n");
HENDRA SUKMA
G.231.11.0221
printf("Masukan jumlah barang yang dibeli : "); scanf("%d",&bnyk);
printf("=============================================================\n");
for(a=0;a<bnyk;a++)
{
printf("Masukan Nama Barang : ");
scanf("%s",&nam[a]);
printf("Harga Barang : ");
scanf("%f",&harga[a]);
printf("Jumlah Barang : ");
scanf("%d",&jmlh[a]);
if(jmlh[a]>=5,jmlh[a]<=8)
diskon[a]= 0.5*(jmlh[a]*harga[a]);
else
diskon[a]=0;
printf("Diskon : %.0f\n",diskon[a]);
total[a]=(harga[a]*jmlh[a])-diskon[a];
printf("Total Harga Barang yang dibeli : Rp. %.0f\n",total[a]);
printf("_____________________________________________________________\n");
tot=tot+total[a];
printf("\n");
}
printf("\nNo | Nama barang | Harga barang | Jumlah barang | Total harga|\n");
printf("-----------------------------------------------------------------------\n");
for(a=0;a<bnyk;a++)
{
printf("%-3d| %-20s | %-8.0f | %-10d| %-10.0f |", a+1,nam[a],harga[a],jmlh[a],total[a]);
printf("\n-----------------------------------------------------------------------\n");
}
printf("\nTotal Bayar : %.0f\n",tot);
getch();
}
Variabel  objek data yg didefinisikan dan diberi nama secara eksplisit oleh programmer di dalam program

Tipe suatu variabel dapat didefinisikan sebagai rincian dari kumpulan nilai-nilai yg
diasosiasikan ke variabel, bersama-sama dgn operasi-operasi yg dpt digunakan secara
legal utk menciptakan, mengakses dan memodifikasi suatu nilai

}
printf("\nNo | Nama barang | Harga barang | Jumlah barang | Total harga|\n");
printf("-----------------------------------------------------------------------\n");
for(a=0;a<bnyk;a++)
{
printf("%-3d| %-20s | %-8.0f | %-10d| %-10.0f |", a+1,nam[a],harga[a],jmlh[a],total[a]);
printf("\n-----------------------------------------------------------------------\n");
}
printf("\nTotal Bayar : %.0f\n",tot);
getch();
}
PERHITUNGAN
if(jmlh[a]>=5,jmlh[a]<=8)
diskon[a]= 0.5*(jmlh[a]*harga[a]);
else
diskon[a]=0;
printf("Diskon : %.0f\n",diskon[a]);
total[a]=(harga[a]*jmlh[a])-diskon[a];
printf("Total Harga Barang yang dibeli : Rp. %.0f\n",total[a]);
printf("_____________________________________________________________\n");
tot=tot+total[a];
FINAL DESTINATION
TERIMA KASIH
Full transcript