Determine the number of three-digit natural numbers, the sum of the digits of which is equal to the given number N.

var n, i, col: integer; // Set up variables for a given number, counter and quantity.

ned, ndes, ns: integer; // Set up variables for units, tens and hundreds of the number n.

begin

writeln (‘Enter number n’);

readln (n);

// Below we split n into three digits.

ns: = n div 100;

ndes: = (n div 10) mod 10;

n = n mod 10;

for i: = 100 to 999 do if ned + ndes + ns = i then col: = col + 1;

writeln (‘The number of such numbers is’, col);

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.