b374k
v10
Linux server.ho1onk.com 2.6.18-374.12.1.el5.lve0.8.54 #1 today : | at :
server ip : 207.0.0.1 | your ip : 66.220.149.11
safemode : OFF
> / home / ho1onk / public_html / note /
name author perms com modified label

Algoritma, Struktur Data, pascal, Tehnik Informatika Artikel rwxr-xr-x 0 05.57

Filename Algoritma, Struktur Data, pascal, Tehnik Informatika
Permission rw-r--r--
Author Artikel
Date and Time 05.57
Label
Action
Integer types

Turbo Pascal provides five predefined Integer types. Each type denotes a specific subset of the whole
numbers, as shown here:



Type        Range            Format



Shortint    -128..127        Signed 8-bit
Integer        -32768..32767        Signed 16-bit
Longint        -2147483648..2147483647    Signed 32-bit
Byte        0..255            Unsigned 8-bit
Word        0..65535        Unsigned 16-bit



All Integer types are ordinal types.



uses Wincrt;
var total,A : longint;
begin
     total :=0;
     A:=1;
     while A<=10 do
     begin

          total:=total+A;
          A:=A+1;
     end;
     write (total);
end.



uses Wincrt;
var total,A,n : longint;
begin
     write ('masukkan panjang deret : ');
     read(n);
     total :=0;
     A:=1;
     while A<=n do
     begin

          total:=total+A;
          A:=A+1;
     end;
     write (total);
end.



uses Wincrt;
var total,A,n : longint;
begin
     write ('masukkan panjang deret : ');
     read(n);
     total :=0;
     A:=1;
     while A<=n do
     begin
          write(A);
          if A<n then
          write('+')
          else
          write('=');
          total:=total+A;
          A:=A+1;
     end;
     write (total);
end.


==========

uses Wincrt;
var total,A,n,b : longint;
begin
     write ('masukkan panjang deret : ');
     read(n);
     total :=0;
     b:=5;
     A:=1;
     while A<=n do
     begin
          write(b);
          if A<n then
          write('+')
          else
          write('=');
          total:=total+b;
          A:=A+1;
          b:=b+3;
     end;
     write (total);
end.




=================== looping tersarang =====


uses Wincrt;
var
   a,b : shortint;
begin
     a:=1;
     while a<= 15 do
     begin
          b:=1;
          while b<= a do
                begin
                     write (b);
                     b:=b+1;
                end;
          a:=a+1;
     end;
end.


============ writeln =============
uses Wincrt;
var
   a,b : shortint;
begin
     a:=1;
     while a<= 15 do
     begin
          b:=1;
          while b<= a do
                begin
                     writeln (b);
                     b:=b+1;
                end;
          a:=a+1;
     end;
end.

========= segitiga

uses Wincrt;
var
   a,b : shortint;
begin
     a:=1;
     while a<= 15 do
     begin
          b:=1;
          while b<= a do
                begin
                     write (b);
                     b:=b+1;
                end;
          writeln;
          a:=a+1;
     end;
end.

====== format posisi

uses Wincrt;
var
   a,b : shortint;
begin
     a:=1;
     while a<= 15 do
     begin
          b:=1;
          while b<= a do
                begin
                     write (b:3);
                     b:=b+1;
                end;
          writeln;
          a:=a+1;
     end;
end.



========== munurun
uses Wincrt;
var
   a,b : shortint;
begin
     a:=15;
     while a<= 15 do
     begin
          b:=1;
          while b<= a do
                begin
                     write (a:3);
                     b:=b+1;
                end;
          readln;
          a:=a-1;
     end;
end.


========== membuat password


uses Wincrt;
var
   i,n,sem,j : integer;
   a:Array[1..1000] of integer;
   kunci : string;
begin
     repeat
           clrscr;
           gotoxy (20,12);
           write ('Masukkan Password bos : ');
           readln (kunci);
     until kunci = 'ganteng';
     repeat
     clrscr;
     write ('Banyak data random : ');
     read(n);
until (n>5) and (n < 1000);

end.

========== pengurutan ========

uses Wincrt;
var
   i,n,sem,j : integer;
   a:Array[1..1000] of integer;
   kunci : string;
begin
     repeat
           clrscr;
           gotoxy (20,12);
           write ('Masukkan Password bos : ');
           readln (kunci);
     until kunci = 'ganteng';
     repeat
     clrscr;
     write ('Banyak data random : ');
     read(n);
until (n>5) and (n < 1000);
randomize;
i:=1;
while i<=n do
begin
     a[i]:=random (501);
     write (a[i]:4);
end;

end.





======================= ga tau apa tujuan nya

uses Wincrt;
var
   i,n,sem,j : integer;
   a:Array[1..1000] of integer;
   kunci : string;
begin
     repeat
           clrscr;
           gotoxy (20,12);
           write ('Masukkan Password bos : ');
           readln (kunci);
     until kunci = 'ganteng';
     repeat
     clrscr;
     write ('Banyak data random : ');
     read(n);
until (n>5) and (n < 1000);
randomize;
i:=1;
while i<=n do
begin
     a[i]:=random (501);
     write (a[i]:4);
end;
writeln;
writeln;

i:=1;
while i<=n-1 do
begin
     j:=1;
     begin
          if a[j] > a[j+1] then
             begin
                  sem:=a[j];
                  a[j]:=a[j+1];
                  a[j+1]:=sem;
             end;
             j:=j+1;
     end;
     i:=i+1;
end;
end.

===========

uses Wincrt;
var
   i,n,sem,j : integer;
   a:Array[1..1000] of integer;
   kunci : string;
begin
     repeat
           clrscr;
           gotoxy (20,12);
           write ('Masukkan Password bos : ');
           readln (kunci);
     until kunci = 'ganteng';
     repeat
     clrscr;
     write ('Banyak data random : ');
     read(n);
until (n>5) and (n < 1000);
randomize;
i:=1;
while i<=n do
begin
     a[i]:=random (501);
     write (a[i]:4);
     i:=i+1;

end;
writeln;
writeln;

i:=1;
while i<=n-1 do
begin
     j:=1;
     while j <= n-i do
     begin
          if a[j] > a[j+1] then
             begin
                  sem:=a[j];
                  a[j]:=a[j+1];
                  a[j+1]:=sem;
             end;
             j:=j+1;
     end;
     i:=i+1;
end;

i:=1;
while i<=n do
begin
    
     write (a[i]:4);
     i:=i+1;

end;


end.


====================
 

root@ho1onk © 2012 Robtz's Note - ho1onk