Những câu hỏi liên quan
Nguyenquochuy
Xem chi tiết
Kiều Vũ Linh
9 tháng 3 2023 lúc 7:37

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.

Bình luận (1)
Thư Uyên
Xem chi tiết
Nguyễn Lê Phước Thịnh
26 tháng 3 2021 lúc 20:05

Bài 1: 

uses crt;

var n,i,s:integer;

begin

clrscr;

write('Nhap n='); readln(n);

s:=0;

i:=1;

while i<=n do 

  begin

s:=s+i;

inc(i);

end;

writeln('Tong cac so trong khoang tu 1 den ',n,' la: ',s);

readln;

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
26 tháng 3 2021 lúc 20:07

Bài 2: 

uses crt;

var n,i,s:integer;

begin

clrscr;

write('Nhap n='); readln(n);

s:=0;

i:=1;

while i<=n do 

  begin

s:=s+i;

i:=i+2;

end;

writeln('Tong cac so le trong khoang tu 1 den ',n,' la: ',s);

readln;

end.

Bình luận (0)
NgocTuan
3 tháng 1 2022 lúc 20:13

alo

Bình luận (0)
crazy
Xem chi tiết
datcoder
20 tháng 1 lúc 19:52

Program HOC24;

var i,d,j,n integer;

begin

readln(n);

for i:=2 to n do

begin

d:=0;

for j:=1 to i do

if i mod j =0 then d=d+1;

if d=2 then write(i,' ');

end;

readln

end.

Bình luận (0)
khánh băng
Xem chi tiết
Nguyễn Lê Phước Thịnh
28 tháng 2 2023 lúc 22:35

uses crt;

var a:array[1..100]of integer;

i,n,dem,kt,j:integer;

begin

clrscr;

readln(n);

for i:=1 to n do write(i:4);

writeln;

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;

readln;

end.

Bình luận (0)
Thiên Phúc
Xem chi tiết
Nguyễn Lê Phước Thịnh
20 tháng 12 2020 lúc 20:00

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.

Bình luận (0)
Lê Tâm Anh
Xem chi tiết
gấu béo
7 tháng 5 2023 lúc 19:20

program Le_Nho_Hon_Hoac_Bang_n;

uses crt;

var

       n, i: integer;

begin

       clrscr;

       write('Nhap vao mot so nguyen duong n: ');

       readln(n);

       while n <= 0 do

       begin

              writeln('So ban nhap khong hop le. Xin vui long nhap lai: ');

              readln(n);

       end;

       clrscr;

       writeln('Cac so le nho hon hoac bang ', n, ' la:');

       i := 1;

       while i <= n do

       begin

              if i mod 2 <> 0 then

                     writeln(i);

              i := i + 1;

       end;

       readln;

end.

Bình luận (0)
NGUYỄN LÊ XUÂN THỊNH
Xem chi tiết
Kiều Vũ Linh
23 tháng 2 2023 lúc 11:23

Bài 1

Var s,i:integer;

tb:real;

Begin

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

i:=1;

s:=0;

While i<=n do

Begin

s:=s+i;

i:=i+1;

End;

tb:=s/n;

Writeln('Tong la ',s);

Write('Trung binh la ',tb:10:2);

Readln;

End.

Bình luận (1)
Kiều Vũ Linh
23 tháng 2 2023 lúc 11:27

Bài 2

Var i,n,souoc:integer;

Begin

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

i:=1;

While i <= n do

Begin

i:=i + 1;

If n mod i = 0 then souoc:=souoc + 1;

End;

If souoc = 1 then write(n,' la so nguyen to')

Else write(n,' khong la so nguyen to');

Readln;

End.

Bình luận (1)
Oanh Kim
Xem chi tiết
Oanh Kim
2 tháng 1 2021 lúc 20:25

help me!!!

 

Bình luận (0)
Bùi Anh Tuấn
2 tháng 1 2021 lúc 20:41

okila

Bình luận (3)
Nguyễn Lê Phước Thịnh
2 tháng 1 2021 lúc 20:52

uses crt;

var n,i,kt,j,dem:integer;

begin

clrscr;

repeat

write('Nhap n='); readln(n);

until n<1000;

dem:=0;

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 inc(dem);

end;

writeln('So luong so nguyen to trong khoang tu 1 toi ',n,' la: ',dem);

readln;

end.

Bình luận (0)
Snsbbdbd Xnxb
Xem chi tiết
Kiều Vũ Linh
13 tháng 5 2023 lúc 8:57

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.

Bình luận (0)