Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
Xoắn Ốc
SUBMITTED BY:
Guest
DATE:
Nov. 21, 2014, 2:13 p.m.
FORMAT:
Text only
SIZE:
913 Bytes
Raw
Download
Tweet
HITS:
1305
Go to comments
Report
PROGRAM XoanOc;
USES Crt;
VAR a:ARRAY[1..20,1..20]OF INTEGER;
i,j,k,x,l,n,ghi:INTEGER;
BEGIN
Write('Nhap so N = ');
Readln(x);
n:=x;
k:=1 ;l:=1; ghi :=1;
REPEAT
BEGIN
BEGIN
i:= k;
FOR j:=l TO n DO
BEGIN
a[j,i]:= ghi ;
inc(ghi);
END;
k:= k+1;
FOR i:= k TO n DO
BEGIN
a[j,i]:= ghi ;
inc(ghi);
END;
n:= n-1;
FOR j:=n DOWNTO l DO
BEGIN
a[j,i]:=ghi;
inc(ghi);
END;
FOR i:= n DOWNTO k DO
BEGIN
a[j,i
]:=ghi;
inc(ghi);
END;
l:= l+1;
END ;
END;
UNTIL n=0 ;
Writeln;
Writeln('Day so da duoc sap xep : ');
Writeln;
FOR i:= 1 TO x DO
BEGIN
FOR j:= 1 TO x DO
Write(a[i,j]:4);
Writeln;
END;
Readln;
END.
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus