uses crt;
var i,n ,dem:integer;
begin
clrscr;
Write( 'nhap so nguyen duong n: ');readln(n);
dem:=0;
for i:=1 to n do if n mod i = 0 then dem:=dem+1;
if(n<2) or (dem< >2) then writeln (n,' khong phai la so nguyen to')
else if dem=2 then writeln(n,' la so nguyen to');
readln
end.
program song_to;
uses crt;
var x,i,dem,tcs,t:longint;
function tongchuso(x:longint):longint;
begin
tcs:=0;
while x<>0 do
begin
tcs:=tcs+x mod 10;
x:=x div 10;
end;
tongchuso:=tcs;
end;
begin
clrscr;
write('nhap vao mot so:');readln(x);
dem:=0;
for i:=1 to x do
if x mod i=0 then dem:=dem+1;
if dem=2 then
begin
t:=0;
for i:=1 to tongchuso(x) do
if tongchuso(x) mod i =0 then t:=t+1;
if t=2 then write(x,' la so song to');
end
else write(x,' k la so song to');
readln;
end.
var t,pn,n,pd:integer;
function ktnt(k:integer):boolean;
var i,t:integer;
begin
t:=0;
for i:=1 to k do
if k mod i=0 then t:=t+1;
if t=2 then ktnt:=true
else ktnt:=false;
end;
begin
write('n=');readln(n);
pn:=n;
t:=0;
repeat
begin
pd:=pn mod 10;
t:=t+pd;
pn:=pn div 10;
end;
until pn=0;
writeln(t);
if ktnt(n) and ktnt(t) then writeln(n,' la so song to ')
else writeln(n,' khong phai so song to ');
readln;
end.