Thursday, March 20, 2014

Algoritma

Nota Belanja PT.Kodel Marudel

#include<stdio.h>
void main()

{
char Nama[30], Alamat[30], NoTelp[30], NB[30];
int hrg1an, jlhbeli, i=0, x;

printf("-------------------------");
printf("\n    PT.KODEL MARUDEL    ");
printf("\n-------------------------");

printf("\nNama    : "); scanf("\n%s", &Nama);
printf("\nAlamat  : "); scanf("\n%s", &Alamat);
printf("\nNo.Telp : "); scanf("\n%s", &NoTelp);

printf("\n");
printf("\n");
x = 0;
printf("Daftar Barang yang Dibeli");
for (i=0;i<=2;i++)
{
printf("\n");
printf("\nNama Barang ke-%i : ", i+1); scanf ("%s", &NB);
printf("\nHarga Satuan : "); scanf("%i", &hrg1an);
printf("\nJumlah Beli : "); scanf("%i", &jlhbeli);
printf("\n");
x = (hrg1an * jlhbeli);
x = x + x + x;
}

printf("total yang harus dibayar : %i", x);
}

3 comments: