Hai Sob Kali Ini saya posting sedikit tentang penjumlahan di pengulangan for pada aplikasi delphi console, Di bawah ini adalah coding - nya:
program Hitung_Barang; //Budi Purnomo
{$APPTYPE CONSOLE}
uses
SysUtils;
var
kode : Array[1..20] of String[10];
Nama : Array[1..20] of string[30];
harga: Array[1..20] of real;
n,i : Integer;
tot : Real;
begin
write('Jumlah Barang = ');;readln(n);
writeln('==================');
//Data Input
for i := 1 to n do
begin
writeln('Data Barang - ',i);
writeln('-----------------');
write('Kode Barang = ');readln(kode[i]);;
write('Nama Barang = ');readln(Nama[i]);
write('Harga = ');readln(harga[i]);
writeln('=============================');
writeln(' ');
end;
//Data Yang Di Tampilkan
writeln('DATA BARANG');
writeln('===========');
writeln(' ');
writeln(' NPM Nama Nilai ');
writeln('===================================================');
for i := 1 to n do
begin
writeln(kode[i]:10,Nama[i]:20,harga[i]:20:2);
tot:=tot+harga[i];
end;
writeln('===================================================');
writeln('TOTAL ',tot:0:2);
writeln('') ;
writeln('========================================') ;
writeln('NAMA: BUDI PURNOMO') ;
writeln('-------------------') ;
writeln('JURUSAN: TEKHNIK KOMPUTER JARINGAN') ;
writeln('----------------------------------') ;
writeln('==================================') ;
readln;
end.
Hasil Outputnya Seperti Di bawah Ini:
Selamat mencoba Sob
program Hitung_Barang; //Budi Purnomo
{$APPTYPE CONSOLE}
uses
SysUtils;
var
kode : Array[1..20] of String[10];
Nama : Array[1..20] of string[30];
harga: Array[1..20] of real;
n,i : Integer;
tot : Real;
begin
write('Jumlah Barang = ');;readln(n);
writeln('==================');
//Data Input
for i := 1 to n do
begin
writeln('Data Barang - ',i);
writeln('-----------------');
write('Kode Barang = ');readln(kode[i]);;
write('Nama Barang = ');readln(Nama[i]);
write('Harga = ');readln(harga[i]);
writeln('=============================');
writeln(' ');
end;
//Data Yang Di Tampilkan
writeln('DATA BARANG');
writeln('===========');
writeln(' ');
writeln(' NPM Nama Nilai ');
writeln('===================================================');
for i := 1 to n do
begin
writeln(kode[i]:10,Nama[i]:20,harga[i]:20:2);
tot:=tot+harga[i];
end;
writeln('===================================================');
writeln('TOTAL ',tot:0:2);
writeln('') ;
writeln('========================================') ;
writeln('NAMA: BUDI PURNOMO') ;
writeln('-------------------') ;
writeln('JURUSAN: TEKHNIK KOMPUTER JARINGAN') ;
writeln('----------------------------------') ;
writeln('==================================') ;
readln;
end.
Hasil Outputnya Seperti Di bawah Ini:
Selamat mencoba Sob
0 komentar:
Posting Komentar
Komentar Anda Mempacu Untuk Yang Lebih Baik Dan Jangan Menghina