uses crt;
var i:integer;
function ts(x:integer):byte;
begin
ts:=0;
while x>0 do
begin
ts:=ts+x mod 10;
x:=x div 10;
end;
end;
BEGIN
clrscr;
i:=1785;
while i>0 do
if 1786-i=ts(i) then
begin
write('Nam sinh cua nha tho Nguyen Du la:',i);
break;
end
else dec(i);
readln
END.
Chúc bạn hc tốt, xin ctlhn!