Given an array of real numbers containing 25 elements, calculate the sum of the array elements

Given an array of real numbers containing 25 elements, calculate the sum of the array elements starting from the first element and the maximum array element inclusive

program zz1;
const n = 25; // set the number of numbers in the array
var i, p: integer; // set a variable of integer type
max, s: real;
x: array [1..n] of real;
begin
for i: = 1 to n do // organize a loop in which we enter n given numbers from the keyboard into the array
read (x [i]);

for i: = 1 to n do
if x [i]> max then begin max: = x [i]; p: = i; end; // check if the array element is greater than the maximum, then write it to the maximum and remember its number
for i: = 1 to p do
s: = s + x [i]; // find the amount

write (‘received sum =’, s: 5: 2); // display the resulting amount in the format of five digits for a number and two decimal places
end.



One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities.