• Twitter
  • Technocrati
  • stumbleupon
  • flickr
  • digg
  • youtube
  • facebook

Follow our Network

Contoh Program Medium TPW bag. 8

0

Label:

Reaksi: 


-------------------------------------------------
Program mod_div;
Uses wincrt;
Var
a,b:array [1..10] of integer;
i:integer;


begin
for i:=1 to 5 do
begin
write('nilai a = ');readln(a[i]);
end;
writeln(' ');

for i:=1 to 5 do
begin
write('nilai b= ');readln(b[i]);
end;
writeln(' ');

for i:=1 to 5 do
begin
writeln(a[i],'mod',b[i],'=',a[i] mod b[i]);
for i:=1 to 5 do
writeln(a[i],'div',b[i],'=',a[i] div b[i]);
end;
writeln(' ');
writeln

end.

--------------------------------------------------

Program Fungsi_Teks;
Uses wincrt;
var
teks:string[50];
a,b,tengah:integer;
begin
write('Masukan Teks: ' );readln(teks);
writeln('Jumlah Teks: ',length (teks));
write('Batas Karakter Awal:');readln(a);
write('Jumlah Karakter yang diambil: ');readln(b);
writeln('Hasil Karakter yang diambil:',copy(teks,a,b));
writeln;
tengah:=length (teks) mod 2;
if tengah = 0 then
writeln('Karakter Tengah: ',copy (teks, (trunc (length(teks)/2)),2))
else
writeln('Karakter Tengah: ',copy (teks, (round (length(teks)/2)),1));
readln;

donewincrt;
end.

------------------------------------------------------------------------------------------

NB: you can copy paste this article..but put into your web or blog, writers and url's Muchfa..!! Thanks..^^

Comments (0)

Posting Komentar

Social Media

  • Subscribe via email

    Enter your email address:

    Delivered by FeedBurner

    Techno 4 U