program BasketballMatch;
varquarter1, quarter2, quarter3, quarter4: Integer;totalTeamA, totalTeamB, maxDifference, maxDifferenceQuarter: Integer;winner: String;
beginwriteln('Enter the results of each quarter for Team A:');readln(quarter1, quarter2, quarter3, quarter4);
totalTeamA := quarter1 + quarter2 + quarter3 + quarter4;
writeln('Enter the results of each quarter for Team B:');readln(quarter1, quarter2, quarter3, quarter4);
totalTeamB := quarter1 + quarter2 + quarter3 + quarter4;
if totalTeamA > totalTeamB thenwinner := 'Team A'else if totalTeamB > totalTeamA thenwinner := 'Team B'elsewinner := 'It is a tie';
writeln('The winner of the match is: ', winner);
maxDifference := Abs(quarter1 - quarter2);maxDifferenceQuarter := 1;
if Abs(quarter2 - quarter3) > maxDifference thenbeginmaxDifference := Abs(quarter2 - quarter3);maxDifferenceQuarter := 2;end;
if Abs(quarter3 - quarter4) > maxDifference thenbeginmaxDifference := Abs(quarter3 - quarter4);maxDifferenceQuarter := 3;end;
writeln('The quarter with the maximum difference in points is: ', maxDifferenceQuarter);end.
program BasketballMatch;
var
quarter1, quarter2, quarter3, quarter4: Integer;
totalTeamA, totalTeamB, maxDifference, maxDifferenceQuarter: Integer;
winner: String;
begin
writeln('Enter the results of each quarter for Team A:');
readln(quarter1, quarter2, quarter3, quarter4);
totalTeamA := quarter1 + quarter2 + quarter3 + quarter4;
writeln('Enter the results of each quarter for Team B:');
readln(quarter1, quarter2, quarter3, quarter4);
totalTeamB := quarter1 + quarter2 + quarter3 + quarter4;
if totalTeamA > totalTeamB then
winner := 'Team A'
else if totalTeamB > totalTeamA then
winner := 'Team B'
else
winner := 'It is a tie';
writeln('The winner of the match is: ', winner);
maxDifference := Abs(quarter1 - quarter2);
maxDifferenceQuarter := 1;
if Abs(quarter2 - quarter3) > maxDifference then
begin
maxDifference := Abs(quarter2 - quarter3);
maxDifferenceQuarter := 2;
end;
if Abs(quarter3 - quarter4) > maxDifference then
begin
maxDifference := Abs(quarter3 - quarter4);
maxDifferenceQuarter := 3;
end;
writeln('The quarter with the maximum difference in points is: ', maxDifferenceQuarter);
end.