I don't know exactly what language you are using (classic pascal, delphi, object pascal, ..etc.), but just to comment on the logic:

1) Initializing the array : looks fine, but mind whether there would be exactly 25 data or may be less.

For i:=1 to max do

begin

SalesArr[i]:='';

TotalPts[i]:=0;

End;

2) Then data input part. There are many ways to input data, but if we follow your approach, you should use one of your options.

Option 1: Using for loop, but end when you enter 'end' to var Salper

n := 0; // let's add N to store the number of salespersons

For i:=1 to max do

Begin

Writeln('enter salper name');

Readln(Salper);

if Salper = 'end' Break; // this jumps out of for loop

Writeln('Enter Branch name');

Readln(branchname);

Writeln('enter number of class 1 vehicles sold');

Readln(class1);

Writeln('enter number of class 2 vehicles sold');

Readln(class2);

Writeln('enter number of class 3 vehicles sold');

Readln(class3);

ttlpts :=(class1 * 1)+(class2 * 3)+(class3 * 5);

Writeln(ttlpts);

SalesArr[i]:=Salper ;

TotalPts[i]:=ttlpts;

end;

if i < max then n := i-1 { because we jumped out of loop, n is one less than i }

else n := i;

Option 2: Use whild loop until you enter "end" for name. You have to think over the logic behind this.

n := 0;

Writeln('enter salper name');

Readln(Salper); // you may enter 'end' at the first input.

while (Salper <> 'end') {and i < Max)} do begin // not sure whether to put i < max condition

inc(n);

Writeln('Enter Branch name');

Readln(branchname);

Writeln('enter number of class 1 vehicles sold');

Readln(class1);

Writeln('enter number of class 2 vehicles sold');

Readln(class2);

Writeln('enter number of class 3 vehicles sold');

Readln(class3);

ttlpts :=(class1 * 1)+(class2 * 3)+(class3 * 5);

Writeln(ttlpts);

SalesArr[n]:=Salper ;

TotalPts[n]:=ttlpts;

Writeln('enter salper name');

Readln(Salper);

end;

Then data input is done.

3) Sorting by the points

There are a few sorting algorithms, but I use the most basic option .. comparing all possible combinations.

// Two temporal variables must have been declared: tname:string; ttotalpts: integer;

for i := 1 to n-1 do begin

for j := i+1 to n do begin

if TotalPts[i] < TotalPts[j] then // you'd like to put highest score first

begin

tTotalPts := TotalPts[i];

TotalPts[j] := TotalPts[i];

TotalPts[i] := tTotalPts;

tname := SalesArr[i]; // Exchange SalesArr as well

SalesArr[i] := SalesArr[j];

SalesArr[j] := tname;

end; // if.. .then block

end; // for j

end; // for i

Now you have "sorted" arrays. SalesArr[1] is the name who has the highest points, and TotalPts[1] is the highest score.

In actuality almost no one would write this kinds of code, but you may think over the codes what each line means. I haven't tested it myself. I just want to show you the logic behind solving this problem.