0% found this document useful (0 votes)
31 views

Algoritma Dan Pemrograman 1: Achmad Fitrah 08350341

This program calculates change from a transaction. The user inputs a total purchase amount and payment amount. It then calculates the change and breakdown of bills and coins in the change, displaying the number of each denomination. It includes calculations for 50,000, 20,000, 10,000, 5,000, 2,000, 1,000, 500, and 100 rupiah coins and bills.

Uploaded by

Achmad Fitrah
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Algoritma Dan Pemrograman 1: Achmad Fitrah 08350341

This program calculates change from a transaction. The user inputs a total purchase amount and payment amount. It then calculates the change and breakdown of bills and coins in the change, displaying the number of each denomination. It includes calculations for 50,000, 20,000, 10,000, 5,000, 2,000, 1,000, 500, and 100 rupiah coins and bills.

Uploaded by

Achmad Fitrah
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

ALGORITMA DAN PEMROGRAMAN 1

Achmad Fitrah 08350341

PROGRAM STUDI TEKNIK INFORMATIKA SEKOLAH TINGGI TEKNIK HARAPAN MEDAN 2011/2012

Coding program #include <stdio.h> #include <conio.h> main() { long belanja, pembayaran, kembalian, sisa, limaplh, duaplh, seplh, lima, dua, seribu, koin5, koin1; clrscr(); printf("Daftar Belanja\n"); printf("==============\n"); printf("Masukan total belanja = Rp "); scanf("%ld",&belanja); printf("Total Pembayaran scanf("%ld",&pembayaran); printf("\n"); printf("Rincian Sisa Kembalian\n"); kembalian = pembayaran - belanja; printf("uang kembalian printf("\n"); limaplh = kembalian / 50000; printf("Pecahan Rp 50.000 sisa = kembalian % 50000; duaplh = sisa / 20000; = %ld lembar\n",limaplh); = Rp %ld",kembalian); = Rp ");

printf("pecahan Rp 20.000 sisa = sisa % 20000; seplh = sisa / 10000; printf("pecahan Rp 10.000 sisa = sisa % 10000; lima = sisa / 5000; printf("pecahan Rp 5.000 sisa = sisa % 5000; dua = sisa / 2000; printf("pecahan Rp 2.000 sisa = sisa % 2000; seribu = sisa/ 1000; printf("pecahan Rp 1.000 sisa = sisa % 1000; koin5 = sisa / 500; printf("koin Rp 500

= %ld lembar\n",duaplh);

= %ld lembar\n",seplh);

= %ld lembar\n",lima);

= %ld lembar\n",dua);

= %ld lembar\n",seribu);

= %ld buah\n",koin5);

sisa = sisa % 500; koin1 = sisa / 100; printf("koin getch(); Rp 100 = %ld buah\n",koin1);

OUTPUT PROGRAM

You might also like