Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program es6pag7;
- var
- V,P,D:array[1..40]of integer;
- i,j,cp,cd,t:integer;
- procedure input;
- begin
- writeln('Dammi 40 numeri');
- for i:=1 to 40 do
- readln(V[i]);
- end;
- procedure separazione;
- begin
- for i:=1 to 40 do
- begin
- if(V[i] mod 2=0)then
- begin
- V[i]:=P[cp];
- cp:=cp+1;
- end
- else
- begin
- V[i]:=D[cd];
- cd:=cd+1;
- end;
- end;
- procedure ordinamento;
- begin
- v:=false;
- repeat
- for i:=1 to cp do
- for j:=1 to cp-1 do
- if(P[j]<P[j+1])then
- begin
- t:=P[j];
- P[j]:=P[j+1];
- P[j+1]:=t;
- end;
- for i:=1 to cd do
- for j:=1 to cd-1 do
- if(D[j]<D[j+1])then
- begin
- t:=D[j];
- V[j]:=D[j+1];
- D[j+1]:=t;
- end;
- end;
- procedure output
- begin
- input;
- cp:=1;
- cd:=1;
- separazione;
- ordinamento;
- output;
- readln;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement