Write a program in the Pascal programming language. A natural number N is given.
June 28, 2021 | education
| Write a program in the Pascal programming language. A natural number N is given. Find the sum 1 + 2 + 3 + 4 + 5 +… + N.
The program will be written in the PascalABC.net programming language;
We will find the sum of numbers up to n using the counter of the for loop and write the value into a separate variable, since the loop step is 1.
begin // start of the program;
var sum: = 0; // initialization of the variable, into which the value of the sum of elements will be written, assigning the initial value to the variable;
for var i: = 1 to n do
sum + = i; // formation of the amount;
writeln (sum); // display the value of the sum;
end. // end of the program;

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.