Find the sum of two-digit numbers in which the number of ones is more than tens. (Pascal)
September 30, 2021 | education
| program zz1;
var a, b, n, i: integer; // set variables of integer type
begin
for i: = 10 to 99 do // organize a loop in which we iterate over all two-digit numbers
begin
a: = i div 10; // get the first digit of a two-digit number
b: = i mod 10; // get the second digit of a two-digit number
if b> a then n: = n + i; // check if the number of ones is more than the number of tens, then add a two-digit number to the sum
end;
write (‘the sum of two-digit numbers in which the number of ones is more than tens =’, n); // display the answer to the screen
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.