Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  m
Language: PASCAL
Code:
uses crt;
var n,i,j,p,k,x:integer;
    a:array[1..50,1..50] of integer;
begin
clrscr;
write('n=');readln(n);
writeln('Ischodnaia matritsha:');
randomize;
for i:=1 to n do
  begin
    for j:=1 to n do
      begin
        a[i,j]:=random(15)-4;
        write(a[i,j]:4);
      end;
  writeln;
  end;
p := n div 2; 
for i:=1 to p do
for k:=i to n-i do
  begin
    x:=a[i,k];
    a[i,k]:=a[n-k+1,i];
    a[n-k+1,i]:=a[n-i+1,n-k+1];
    a[n-i+1,n-k+1]:=a[k,n-i+1];
    a[k,n-i+1]:=x;
  end;
Writeln('Povorot na 90 grad:');
for i:=1 to n do
  begin
    for j:=1 to n do
    write(a[i,j]:4);
    writeln;
  end;
readln
end.
          
Comments: