Những câu hỏi liên quan
Viet anh Nguyen
Xem chi tiết
Trúc Giang
14 tháng 8 2021 lúc 9:07

Uses crt;

Var i,n:integer;

S:real;

Begin

Write ('Nhap n');

Readln (n)

S:=0;

For i:=3 to n do 

S:=S+2/i;

Write ('Ket qua',S);

Readln; 

End.

Bình luận (0)

Hay nhỉ

Bình luận (0)
Kỳ AnH
Xem chi tiết
Nguyễn Lê Phước Thịnh
23 tháng 2 2023 lúc 20:52

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.

Bình luận (0)
Nguyễn Thanh Anh
Xem chi tiết
Nguyễn Lê Phước Thịnh
17 tháng 2 2023 lúc 7:43

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.

Bình luận (1)
Nguyenquochuy
2 tháng 3 2023 lúc 19:48

Viết chương trình pascal nhập n ( n>0 ) xuất ra màn hình các số hoàn toàn từ 1-2n và cho bt có bao nhiêu số như vậy

Bình luận (0)
MinhThu
Xem chi tiết
Kiều Vũ Linh
13 tháng 4 2023 lúc 13:59

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.

Bình luận (0)
HT.Phong (9A5)
13 tháng 4 2023 lúc 12:56

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.

Bình luận (0)
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)
Thu Tuyền
Xem chi tiết
Minh Lệ
7 tháng 3 2023 lúc 21:23

Program HOC24;

var i,n: integer;

S: longint;

begin

write('Nhap N: '); readln(n);

i:=1; s:=0;

while i<=n do

begin

s:=s+i;

i:=i+2;

end;

write('S=',S);

readln

end.

Bình luận (0)
Nguyễn Hoàng Duy
24 tháng 3 2023 lúc 10:30

program tinh_tong_S;

var
  n, i, S: integer;

begin
  write('Nhap n: ');
  readln(n);
  
  S := 0;
  i := 1;
  
  while i <= n do
  begin
    S := S + i;
    i := i + 2;
  end;
  
  writeln('Tong S la: ', S);
  
  readln;
end.

Bình luận (0)
Thanh huyền
Xem chi tiết
Minh Lệ
7 tháng 3 2023 lúc 17:08

Đề sai đúng không, bạn kiểm tra lại đề nhé, mình không thấy quy luật gì trong dãy tổng của S cả

Bình luận (1)
Minh Lệ
7 tháng 3 2023 lúc 17:36

FOR..DO

Program HOC24;

var i,n: integer;

s: longint;

begin

write('Nhap N: '); readln(n);

S:=0;

For i:=1 to N do if i mod 2=0 then S:=S+i;

write('S = ',S);

readln

end.

Bình luận (0)
Minh Lệ
7 tháng 3 2023 lúc 23:02

While..do

Program HOC24;

var i,n: integer;

s: longint;

begin

write('Nhap N: '); readln(n);

S:=0; i:=2;

while i<=n do 

begin

s:=s+i;

i:=i+2;

end;

write('S = ',S);

readln

end.

Bình luận (0)
Ngọc Tú
Xem chi tiết
Phía sau một cô gái
7 tháng 3 2023 lúc 19:46

var n, s, i: integer;

begin

       write('Nhap n = ');

       readln(n);

       s := 0;

       i := 3;

       while i <= n do

       begin

              s := s + i;

              i := i + 3;

       end;

       writeln('Tong la ', s);

       readln;

end.

Bình luận (0)
Nguyễn Hoàng Duy
24 tháng 3 2023 lúc 10:31

program tinh_tong_S;

var
  n, i, S: integer;

begin
  write('Nhap n: ');
  readln(n);
  
  S := 0;
  
  for i := 3 to n step 1 do
  begin
    if i mod 2 = 0 then
      S := S + i;
  end;
  
  writeln('Tong S la: ', S);
  
  readln;
end.

Bình luận (0)
Đoàn Lê Na
Xem chi tiết
khanh
12 tháng 3 2019 lúc 20:59

mình thách bạn cũng với đề ấy trong chương trình scratch

Bình luận (0)