#include <stdio.h>
main()
{
int bulan, x;
long int bayar;
float total, kredit, bulanan;
printf("Harga barang: ");scanf("%ld", &bayar);
printf("lama kredit: ");scanf("%d", &bulan);
printf("====================================================\n");
printf("bulan ke | bunga | bayar/bln | total |\n");
printf("=====================================================\n");
printf("\n");
x = 0;
while(x<bulan)
{
x++;
if(bulan>=12) { kredit= (0.15*bayar/bulan); bulanan = ((bayar/bulan)+kredit);
} else { kredit = (0.05*bayar/bulan);
bulanan = ((bayar/bulan)+kredit); }
total = bulanan*x; printf("%d | %0.1f | %0.1f | %0.1f |\n", x, kredit, bulanan, total);
} return 0;
}
main()
{
int bulan, x;
long int bayar;
float total, kredit, bulanan;
printf("Harga barang: ");scanf("%ld", &bayar);
printf("lama kredit: ");scanf("%d", &bulan);
printf("====================================================\n");
printf("bulan ke | bunga | bayar/bln | total |\n");
printf("=====================================================\n");
printf("\n");
x = 0;
while(x<bulan)
{
x++;
if(bulan>=12) { kredit= (0.15*bayar/bulan); bulanan = ((bayar/bulan)+kredit);
} else { kredit = (0.05*bayar/bulan);
bulanan = ((bayar/bulan)+kredit); }
total = bulanan*x; printf("%d | %0.1f | %0.1f | %0.1f |\n", x, kredit, bulanan, total);
} return 0;
}
Comments