Đăng nhập để hỏi chi tiết


Ngon ngữ pascal nhá `^^^^^^`
Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
uses crt;
var n,tam,t,d:int64;
function giaithua(n:int64):int64;
begin
if n=0 then
giaithua:=1
else
begin
giaithua:=1;
while n>1 do
begin
giaithua:=giaithua*n;
dec(n);
end;
end;
end;
begin
clrscr;
readln(n);
tam:=n;
t:=0;
while tam>0 do
begin
d:=tam mod 10;
t:=t+giaithua(d);
tam:=tam div 10;
end;
if t=n then
writeln(1)
else
Writeln(0);
end.Hãy giúp mọi người biết câu trả lời này thế nào?
![]()
program test;
uses crt;
var i,n,temp,sum,tmp,tmp2:longint;
begin
clrscr;
readln(n);
temp:=n;
sum:=0;
while (temp<>0) do
begin
tmp:=temp mod 10;
tmp2:=1;
for i:=1 to tmp do
tmp2:=tmp2*i;
sum:=sum+tmp2;
temp:= temp div 10;
end;
if sum=n then
writeln('1')
else
writeln('0');
end.Hãy giúp mọi người biết câu trả lời này thế nào?
![]()
Bảng tin