Chương trình nhe:
Program LangGieng;
Uses crt;
Var a, b, s1, s2:integer; fi, fo:text;
Procedure uoc (n, s: integer)
Var i:integer;
begin
i:=1;
While i <= n do
begin
s:=0;
if (n mod i) = 0 then s:=s+i;
i:= i+1;
end;
end;
Begin
assign(fi,'LANGGIENG.inp'); reset(fi);
read(fi,a, b); close(fi);
uoc(a,s1);
uoc (b,s2);
assign(fo,'LANGGIENG.OUT');
rewrite(fo);
if s1 = s2 then Writeln(fo,'CO')
else
writeln(fo,'KHONG');
close(fo);
End.
Em chưa có chạy thử nhe ^^.