Documente Academic
Documente Profesional
Documente Cultură
House Name
House Points
House Funds
Processing
Read House Name
Read House Points
Read Funds
Calculate total points aggregated in the athlete sprint
Output
Print House Name
Print Points
Print Funds
Total Points
events
Calculate 45% of funds to the house with the highest
points
Calculate 17% of funds to the house with the least points
Programming Arrays
Algorithm
Var
HouseName: string;
Points: integer;
totalfund: real;
For 1 to 4
Print HouseName
Read HouseName
Print Enter points
Read Points
Endfor
Read totalfund
Maxfund= 0.45* totalfund
Minfund=0.17*totalfund
For 1 to 4
Totalpoints = totalpoints+points
Endfor
For 1 to 4
If Highestpoint< points then
Highestpoint= points
Candidate Name: Amilla Morille
Candidates Registration Number: 1400100922
Centre Number: 140010
END IF
END FOR
For 1 to 4
If Minpoint> points then
Minpoint= points
END IF
END FOR
Print house with maximum amount
Print Maxfund
Print house with minimum amount
Print Minfund
Pseudo Code
Program Athletic_Sports_Meet_Event;
{Program header}
Var
i, total, max,min:integer;
hpt:array[1..4]of integer;
{Declaration of
variables}
house:array[1..4] of string;
maxhouse,minhouse:string;
BEGIN
i:=0;
total:=0;
max:=0;
{Program Block}
min:=1000;
maxhouse:='';
minhouse:='';
for i:= 1 to 4 do
begin
house[i]:='';
hpt[i]:=0;
end;
Candidate Name: Amilla Morille
Candidates Registration Number: 1400100922
Centre Number: 140010
For i:= 1 to 4 do
begin
write('Enter the house name');
readln(house[i]);
total:=total + hpt[i];
end;
For i:= 1 to 4 do
begin
Candidate Name: Amilla Morille
Candidates Registration Number: 1400100922
Centre Number: 140010
writeln;
writeln('The victorious house was ',maxhouse);
writeln('Victorious house points: ',max);
writeln('The trailing house was ',minhouse);
writeln('The lowest score was ',min);
writeln('The total house points was: ',total);
END.
{Program Terminator}
Candidate Name: Amilla Morille
Candidates Registration Number: 1400100922
Centre Number: 140010
minValue:99999;
maxValue:=0;
maxhouse:='';
minhouse:='';
For i:= 1 to 4 do
begin
write('Enter the house name');
readln(house[i]);
total:=total + hpt[i];
end;
//comment: the above stored all the values and calculated totals.
//below is find highest and lowest values
For i:= 1 to 4 do
begin
readln(hpt[i]);
If hpt[i]> maxValue then
Candidate Name: Amilla Morille
Candidates Registration Number: 1400100922
Centre Number: 140010
begin
maxValue:= hpt[i];
maxhouse:= house[i];
end;
If hpt[i]< minValue then
begin
minValue:= hpt[i];
minhouse:= house[i];
end;
writeln('The victorious house was ',maxhouse);
writeln('Victorious house points: ',maxValue);
writeln('The trailing house was ',minhouse);
writeln('The lowest score was ',minValue);
writeln('The total house points was: ',total);
END