filem

Watch Free Online Live Dragon Ball Season Episode Saga Watch Free Online Live Dragon Ball Z Season Episode Saga Watch Free Online Live Dragon Ball GT Season Episode Saga Watch Free Online Live Case Closed Season Episodes Watch Free Online Live Pokemon Season Episodes Watch Free Online Live One Piece Season Episodes Watch Free Online Live Naruto Season Episodes

Kamis, 28 Oktober 2010

Program pascal - perulangan bilangan

Buat tampilan program dibawah ini dengan menggunakan metode perulangan  
               
       1 2 3 4                         2 2 2                            3 2 1
       1 2 3 4                         1 1 1                            3 2 1

       1 2 3 4                         0 0 0                            3 2 1
       1 2 3 4

       1                                  4 3 2 1                         1         
       1 2                               4 3 2                            3   5  
       1 2 3                            4 3                               7   9   11
       1 2 3 4                         4                                  13 15 17 19
           
Jawab:
1.         uses crt;                         
   var I,J :integer;
   begin
   clrscr;
     for I:=1 to 4 do
     begin
     for J:= 1 to 4 do
     write(J:4);
     writeln;
     end;
     readln;
   end.

2.    uses crt;
   var A, I,J: integer;
   begin
     clrscr;
     A:=2;
     for I:= 1 to 3 do
     begin
     for J:= 1 to 3 do
     write(A:4);
     A:=A-1; writeln;
     End;
     Readln;
end.


3. uses crt; var i, j: byte;
      begin
         clrscr;
         for i:= 1 to 3 do
         begin
         for j:= 3 downto 1 do
         write(j:4); writeln;
         end;
         readln;
        end.

4. uses crt;
   var i, j: integer;
   begin
     clrscr;
     for i:= 1 to 4 do
     begin
     for j:= 1 to i do
     write(j:4); writeln;
     end;
     readln;
   end.

1.  5. uses crt;
   var A, i,j:integer;
   begin
     clrscr;
     for i:= 4 downto 1 do
     begin
     A:=4;
     for j:= 1 to i do
     begin
     write(A:4);
     A:=A-1;
     end;
     writeln;
     end;
     readln;
   end.

6. uses crt;
   var A, i, j: byte;
   begin
     clrscr;
     A:= 1;
     for i:= 1 to 4 do
     begin
     for j:= 1 to i do
     begin
     write(A:4);
     A:= A+2;
     end;
     writeln;
     end;
     readln;
   end.

Tidak ada komentar:

Posting Komentar