Home   Easy-Code    Forum  Updater 
Twitter Facebook



Sorting arrays using pascal

Critics Rating:

Users Rating:

program rev;

uses crt;

var

A,B,C:Array[1..50] of integer;

i,k,n,m,temp:integer;

begin

clrscr;

writeln("ENTER THE LENGTH OF FIRST ARRAY ");

read(n);

writeln("ENTER ",n," NUMBERS ");

for i:=1 to n do

read(A[i]);

writeln("ENTER THE LENGTH OF SECOND ARRAY ");

read(m);

writeln("ENTER ",m," NUMBERS ");

for k:=1 to m do

read(B[k]);

for i:=1 to n do

c[i]:=A[i];

for k:=1 to m do

c[n+k]:=B[k];

writeln("THE SORTED ARRAY IS ");

for i:=1 to n+m do

begin

if C[i]
begin

temp:=C[i];

C[i]:=C[i+1];

C[i+1]:=temp;

end;

writeln(C[i]);

end;

for i:=1 to n+m do

writeln(C[i]);

end.



Courtesy, Source, References & Regards: Kishore AVGK

While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright@2009-2011 by KuGuNi.com. All Rights Reserved.