K
Khách

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.

24 tháng 2 2023

Làm mỗi "số nguyên tố từ 2->n" được ko

9 tháng 3 2023

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.

9 tháng 3 2023

Cám ơn nhiều

13 tháng 4 2023

var tam,a,b,i:integer;

begin

write('a = ');readln(a);

write('b = ');readln(b);

if a < b then

begin

tam:=a;

a:=b;

b:=tam;

end;

for i:=a to b do

if sqrt(i) = trunc(sqrt(i)) then write(i:10);

readln;

End.

17 tháng 3 2021

17 tháng 3 2021

dạ while...do nhé 

20 tháng 12 2020

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.

13 tháng 5 2023

Var i,n:integer;

Begin

Write('n = ');readln(n);

Write('Day so tu 1 den ',n,' la ');

For i:=1 to n do write(i:8);

Readln

End.

4 tháng 5 2023

program TinhTongTich;

var

      N, i, Tong, Tich:integer;

begin

      writeln('Nhap so nguyen duong N:');

      readln(N);

      i:=1;

      Tong:=0;

      Tich:=1;

      while i<=N do

      begin

            Tong:=Tong+i;

            Tich:=Tich*i;

            i:=i+1;

      end;

      writeln('Tong cac so tu 1 den ', N, ' la: ', Tong);

      writeln('Tich cac so tu 1 den ', N, ' la: ', Tich);

      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.

16 tháng 1 2020

bạn ơi cho mình hỏi "hop so" là gì vậy bạn