Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted by DhL ( 15 years ago )
program five;

uses crt;
const
     nx=5;
     ny=5;

var
    a: array [1..nx, 1..ny] of real;
    i,j,summa,nomer_stroki,pred,max_count : byte;


begin
                              clrscr;
  a[1,1]:=0;
  a[1,2]:=0;
  a[1,3]:=0;
  a[1,4]:=0;
  a[1,5]:=0;

  a[2,1]:=-1;
  a[2,2]:=0;
  a[2,3]:=-3;
  a[2,4]:=-4;
  a[2,5]:=5;

  a[3,1]:=0;
  a[3,2]:=0;
  a[3,3]:=2;
  a[3,4]:=0;
  a[3,5]:=0;

  a[4,1]:=0;
  a[4,2]:=0;
  a[4,3]:=-3;
  a[4,4]:=-4;
  a[4,5]:=0;

  a[5,1]:=0;
  a[5,2]:=0;
  a[5,3]:=0;
  a[5,4]:=0;
  a[5,5]:=0;

summa:=0;
nomer_stroki:=0;
pred:=0;
max_count:=0;
for i:=1 to nx do
begin
     summa:=0;

     for j:=1 to ny do
         if a[i,j]<0 then summa:=summa+1;

     if summa > max_count then
     begin
        nomer_stroki := i;
        max_count := summa;
     end;

     if summa > 0 then
        a[i,i]:=summa;

end;

writeln('nomer_stroki=',nomer_stroki);
writeln('kol-vo otritsatelnih  elementov=',max_count);

Writeln('izmenenniy massiv:');
for i:=1 to nx do
begin
for j:=1 to ny do
write(a[i,j] :3:1,' ');
writeln;
end;
readln;
end.

 

Revise this Paste

Your Name: Code Language: