program thuchien;
uses crt;
var n,d,i,j:integer;
t:longint;
kt:boolean;
begin
clrscr;
write('Nhap N: '); readln(n);
writeln('Chu so cuoi cung cua ',n,' la: ',n mod 10);
t:=0;
for i:=1 to n do
t:=t+i;
writeln('Tong cac so tu 1->',n,' la: ',t);
d:=0;
for i:=2 to n do
begin
kt:=true;
for j:=2 to trunc(sqrt(i)) do
if i mod j=0 then kt:=false;
if kt=true then d:=d+1;
end;
writeln('Co ',d,' so nguyen to tu 1->',n);
write('Cac uoc cua ',n,' la:');
for i:=1 to n do
if n mod i=0 then write(' ',i);
writeln;
t:=0;
while n>0 do
begin
t:=t+n mod 10;
n:=n div 10;
end;
write('Tong cac chu so la: ',t);
readln
end.