Sub sss() stroka = 3 m = Cells(2, 3) For i = 100 To 999 a1 = Int(i / 100) a2 = Int((i - a1 * 100) / 10) a3 = i - a1 * 100 - a2 * 10 If a1 + a2 + a3 = m Then Cells(stroka, 3) = i stroka = stroka + 1 End If Next i End Sub
Var m, a, b, c: integer; begin write('m = '); readln(m); if (m>0) and (m<27) then begin for a:=1 to 9 do for b:=1 to 9 do for c:=1 to 9 do if a+b+c=m then writeln(a,b,c); end else writeln('m>0 and m<27'); end.
stroka = 3
m = Cells(2, 3)
For i = 100 To 999
a1 = Int(i / 100)
a2 = Int((i - a1 * 100) / 10)
a3 = i - a1 * 100 - a2 * 10
If a1 + a2 + a3 = m Then
Cells(stroka, 3) = i
stroka = stroka + 1
End If
Next i
End Sub
begin
write('m = ');
readln(m);
if (m>0) and (m<27) then
begin
for a:=1 to 9 do
for b:=1 to 9 do
for c:=1 to 9 do
if a+b+c=m then writeln(a,b,c);
end
else writeln('m>0 and m<27');
end.