Piska122's blog

By Piska122, history, 9 months ago, In Russian

const M=10; var a:array [1..M] of integer; var b,c,d,j,i,k:integer; begin randomize;

for i:=1 to M do begin b:=random(20) -10; a[i]:=b; end; for i := 1 to m-1 do for j := 1 to m-i do if a[j] < a[j+1] then begin k := a[j]; a[j] := a[j+1]; a[j+1] := k end; for i:=M downto 1 do begin if a[i] >=0 then else

b:=i;

end; for i:=b to m-1 do for J:=b to m-i do if a[j]< a[j+1] then begin k:=a[j]; a[j]:=a[j+1]; a[j+1]:=k; end; writeln(a); end.

///////////////// const M=10; var a,z:array [1..M] of integer; var b,c,d,j,i,k,sum:integer; begin randomize;

for i:=1 to M do begin b:=random(20) + 10; a[i]:=b; end; writeln(a); sum:=0; for i:=1 to m do begin while a[i]>0 do begin sum:=sum + a[i] mod 10; a[i]:=a[i] div 10; end; z[i]:=sum; sum:=0;

end; writeln(z); for i := 1 to m-1 do for j := 1 to m-i do if z[j] < z[j+1] then begin k := z[j]; z[j] := z[j+1]; z[j+1] := k end; writeln(z); end.

 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it