Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.
uses crt;
var i,n,dem:integer;
begin
clrscr;
readln(n);
dem:=0;
i:=1;
while i<=n do
begin
if trunc(sqrt(i))=sqrt(i) then begin inc(dem); write(i:4);
end;
i:=i+1;
end;
writeln;
writeln(dem);
readln;
end.
uses crt;
var n,i,kt,j:integer;
begin
clrscr;
readln(n);
i:=1;
while (i<n) do
begin
i:=i+1;
kt:=0;
for j:=2 to i-1 do
if i mod j=0 then kt:=1;
if kt=0 then write(i:4);
end;
readln;
end.
var i,n,s,du,dem:integer;
Begin
While n<=0 do
Begin
Write('N = ');readln(n);
End;
For i:=1 to n do
If n mod i = 0 then
Begin
Write(i:7);
du:=du+1;
s:=s+i;
End;
Writeln('So uoc cua ',n,' la ',du);
Writeln('Tong cac uoc cua ',n,' la ',s);
For i:=1 to s do
If s mod i = 0 then dem:=dem+1;
If dem=2 then write(s,' la so nguyen to')
Else write(s,' khong la so nguyen to');
Readln;
End.
Program hotrotinhoc_hoc24;
var i,n: integer;
function nt(x: longint): boolean;
var j: longint;
begin
nt:=true;
if (x=2) or (x=3) then exit;
nt:=false;
if (x=1) or (x mod 2=0) or (x mod 3=0) then exit;
j:=5;
while (j<=trunc(sqrt(x))) do
begin
if (x mod j=0) or (x mod (j+2)=0) then exit;
j:=j+6;
end;
nt:=true;
end;
begin
write('Nhap n='); readln(n);
if nt(n) then writeln(N ,'la so nguyen to') else writeln(N,' khong phai so nguyen to');
write('Cac so nguyen to tu 0 den ',n,' la :');
i:=0;
while i<=n do
begin
i=sqr(trunc(sqrt(i))) then write(i,' ');
i:=i+1;
end;
writeln;
write('Cac so nguyen to tu 2 den ',n,' la :');
i:=2;
while i<=n do
begin
if nt(i) then write(i,' ');
i:=i+1;
end;
readln
end.
program TinhTongVaUoc;
var
a, b, sum, i: integer;
uoc: boolean;
begin
write('Nhap so a: ');
readln(a);
write('Nhap so b: ');
readln(b);
// Tinh tong a+b
sum := a + b;
writeln('Tong cua a va b la: ', sum);
// In ra cac uoc cua tong
write('Cac uoc cua tong a+b la: ');
for i := 1 to sum do
begin
if sum mod i = 0 then
write(i, ' ');
end;
writeln;
// Kiem tra xem tong a+b co phai la so hoan hao hay khong
uoc := false;
for i := 1 to sum - 1 do
begin
if sum mod i = 0 then
uoc := true;
end;
if uoc and (sum = 2 * sum div 2) then
writeln('Tong a+b la so hoan hao')
else
writeln('Tong a+b khong phai la so hoan hao');
end.
uses crt;
var n,i,kt,j,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
writeln('Cac so nguyen to trong khoang tu 2 toi ',n,' la: ');
for i:=2 to n do
begin
kt:=0;
for j:=2 to i-1 do
if i mod j=0 then kt:=1;
if kt=0 then write(i:4);
end;
writeln;
writeln('Cac so chinh phuong trong khoang tu 0 toi ',n,' la: ');
for i:=0 to n do
if trunc(sqrt(i))=sqrt(i) then write(i:4);
writeln;
writeln('Cac so hoan hao trong khoang tu 1 toi ',n,' la: ');
for i:=1 to n do
begin
t:=0;
for j:=1 to i-1 do
if i mod j=0 then t:=t+j;
if t=i then write(i:4);
end;
readln;
end.
uses crt;
var n,kt,s,i,j,k:integer;
{--------------------------------chuong-trinh-con----------------------------------------}
function ktngto(var x:integer):boolean;
var a:integer;
begin
ktngto:=true;
a:=round(sqrt(x));
if n mod a<>0 then ktngto:=false
else ktngto:=true;
end;
{-------------------------------chuong-trinh-chinh------------------------------------}
begin
clrscr;
write('n='); readln(n);
if n>1 then
begin
if ktngto(n)=false then writeln(n,' la so nguyen to')
else writeln(n,' la hop so');
end
else writeln(n,' khong la so nguyen to cung khong la hop so');
if n>=0 then
begin
if n=0 then writeln(0)
else
begin
s:=-1;
while s<=n do
begin
inc(s);
if trunc(sqrt(s))=sqrt(s) then write(s:4);
end;
end;
end;
writeln;
j:=2;
while j<=n do
begin
j:=j+1;
if ktngto(j)=false then write(j:4);
end;
readln;
end.
var i,n:integer;
begin
write('n = ');readln(n);
i:=2;
while n mod i <> 0 do i:=i+1;
if i = n then write(n,' la so nguyen to')
else write(n,' khong la so nguyen to');
readln
end.
Uses crt;
var i,n,p: integer;
begin clrscr;
readln(n);
for i:=1 to n do if(n mod i=0) then p:=p+1;
if(p=2) then writeln(n,' la so nguyen to')
else writeln(n,' khong phai la so nguyen to');
readln;
end.