# Write a program in Pascal. Find the sum of 10 odd numbers.

September 27, 2021 | education

| program zz1;

var k, s, i: integer; // set variables of integer type

begin

k: = 0; // set the initial value for the number of odd numbers

i: = 1; // set the initial value for the loop parameter

while k <10 do // organize a loop until the number of odd numbers reaches ten

begin

if i mod 2 = 1 // check the condition, if the number is odd, then add it to the sum and calculate

then begin k: = k + 1; s: = s + i; end;

i: = i + 1; // increase the loop parameter by one

end;

write (‘sum of ten odd numbers =’, 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.