Help translate the C++ code
var d1, d2, d3, k, n: integer;
begin
writeln ('Enter the number n with which we will compare the sum of the digits of the number');
readln (n);
k: = 0;
{d1 - left, d2 - middle, d3 - right digits of the number}
for d1: = 1 to 9 do
for d2: = 0 to 9 do
for d3: = 0 to 9 do
if (d1 + d2 + d3 = n) then
begin
k: = k + 1;
write (d1, d2, d3, '');
end;
writeln ('The number of required numbers is -', k);
end.
Answer 1
# include & lt; stdio.h & gt;
int main (int argc, char * argv []) {
int d1, d2, d3, k, n;
printf ("Enter the number n with which we will compare the sum of the digits of the number \ n");
scanf ("% d", & amp; n);
k = 0;
for (d1 = 1; d1 & lt; = 9; ++ d1)
...
...
if (d1 + d2 + d3 == n) {
k + = 1;
printf ("% d% d% d", d1, d2, d3)
}
...
}
What to insert instead of ellipsis, I think you’ll figure it out.