Find the sum of all positive numbers not exceeding a given natural number N. Pascal program.
May 24, 2021 | education
| program zz1;
var i, s, n: integer; // set variables of integer type
begin
write (‘enter the given number’); // enter a number from the keyboard
read (n);
for i: = 1 to n do // organize a loop in which we iterate over all numbers from one to n
s: = s + i; // calculate the sum of all numbers not exceeding this natural number
writeln (‘the sum of all positive numbers not exceeding a given natural number =’, s); // display the answer
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.