Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
Ảnh 1 : kiểm tra có chạy đúng bước chưa
Ảnh 2 : đã xóa các câu lệnh dư thừa
Code ảnh 1 :
Uses crt;
var n, s , a, kt: longint;
Ql : string ;
begin
clrscr;
readln(n);
while n<> 0 do
begin
a := n mod 10;
s := s + a ;
n := n div 10 ;
end ;
writeln(s);
Kt := round(sqrt(s));
if (s mod kt <> 0) or (s=2) then
begin
Write('La so nguyen to ');
str(s,ql);
Writeln(ql);
if pos('9',ql)<>0 then Writeln('YES')
else Writeln('No');
end;
end.
Code ảnh 2 :
Uses crt;
var n, s , a, kt: longint;
Ql : string ;
begin
clrscr;
readln(n);
while n<> 0 do
begin
a := n mod 10;
s := s + a ;
n := n div 10 ;
end ;
Kt := round(sqrt(s));
if (s mod kt <> 0) or (s=2) then
begin
str(s,ql);
if pos('9',ql)<>0 then Writeln('YES')
else Writeln('No');
end;
end.
Hãy giúp mọi người biết câu trả lời này thế nào?
uses crt;
var i,s,a,b:integer;
n:string;
ok: boolean;
begin
clrscr;
write('nhap so can kiem tra: '); readln(n);
s:=0;
for i:=1 to length(n) do
begin
val(n[i],a,b);
s:=s+a;
end;
if s<=1 then ok:=false
else
begin
i:=2;
while (s mod i<>0) do i:=i+1;
if i=s then ok:=true
else ok:=false;
end;
if (ok=true) and ((s-9) mod 10=0) then writeln('yes')
else writeln('no');
readln;
end.
Hãy giúp mọi người biết câu trả lời này thế nào?
Bảng tin
1165
390
1946
Tháng sau vô nhs nhóc con này nhé bà cô !!