Program 1 :
# include <stdio.h>
# include <conio.h>
# include <iostream.h>
void main ()
{
float harga_sepatu, harga_kaos_kaki, uang_kembali, harga_total, harga_bayar ;
cout << "Harga sepatu = Rp. " ;
cin >> harga_sepatu ;
cout << "Harga kaos kaki = Rp. " ;
cin >> harga_kaos_kaki ;
cout << "Harga bayar = Rp. " ;
cin >> harga_bayar ;
harga_total = harga_sepatu + harga_kaos_kaki ;
uang_kembali = harga_bayar - harga_total ;
cout << "Uang kembali = Rp. " << uang_kembali << endl ;
}
Program 2 :
# include <stdio.h>
# include <conio.h>
# include <iostream.h>
void main ()
{
int a,b,c,d,e ;
cout << "Jatah tiap minggu = " ;
cin >> a ;
cout << "Jatah yang dikurangi = " ;
cin >> b ;
cout << "Jumlah pelanggan = " ;
cin >> d ;
c = a - b ;
e = c / d ;
cout << "Jatah yang diterima pelanggan = " << e << endl ;
}
Program 3 :
# include <stdio.h>
# include <conio.h>
# include <iostream.h>
void main ()
{
float a,b,c,d,e,f ;
long g,h ;
cout << "Total batu bata = " ;
cin >> a ;
cout << "Total semen = " ;
cin >> b ;
cout << "Harga 1000 batubata = Rp. " ;
cin >> c ;
cout << "Harga 1 sak semen = Rp. " ;
cin >> d ;
e = a / 1000 ;
h = e * c ;
f = d * b ;
g = h + f ;
cout << "Total bayar = Rp. " << g << endl ;
}
Tidak ada komentar:
Posting Komentar