Những câu hỏi liên quan
Chuu
Xem chi tiết
Minh Lệ
6 tháng 3 2023 lúc 23:26

Program HOC24;

uses crt;

var i,n: integer;

s: real;

begin

clrscr;

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

s:=0;

for i:=1 to n do s:=s+1/(i*(i+1));

write('S= ',s:6:2);

readln

end.

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

Program HOC24;

var i,n: integer;

S: real;

begin

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

i:=1; s:=0;

while i<=n do

begin

s:=s+i*(i+1);

i:=i+1;

end;

write('S=',S:5:2);

readln

end.

Bình luận (0)
Khánh Hoàng
Xem chi tiết
Minh Lệ
7 tháng 3 2023 lúc 22:51

Program HOC24;

var i,n: integer;

S: longint;

begin

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

i:=2; 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
19 tháng 3 2023 lúc 22:42

program TongCacSoChan;
var
    n, s, i: integer;
begin
    write('Nhap n: ');
    readln(n);
    s := 0;
    i := 2;
    while i <= n do
    begin
        s := s + i;
        i := i + 2;
    end;
    writeln('Tong cac so chan la: ', s);
    readln;
end.

 

Bình luận (0)
Hùng Bùi
Xem chi tiết
Ngô Bá Hùng
16 tháng 4 2023 lúc 10:00

n = int(input("Nhap n: "))
sum_even = 0
for i in range(2, n+1, 2):
    sum_even += i
print("Tong cac so chan lien tiep den", n, "la:", sum_even)

 

python ha:0?

Bình luận (4)
Nguyễn Huỳnh Khôi Nguyên
Xem chi tiết
Nguyễn Lê Phước Thịnh
1 tháng 5 2021 lúc 19:39

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(s);

readln;

end.

Bình luận (0)
Nguyễn Huỳnh Khôi Nguyên
3 tháng 5 2021 lúc 11:37

ae nào giúp mình với ạ'

 

Bình luận (0)
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)
thanh mai
Xem chi tiết
Thanh Phong (9A5)
11 tháng 4 2023 lúc 15:22

Cách 1 dùng lệnh for do:

Uses crt;

var i,n,k: integer;

begin clrcsr;

readln(n);

for i:=1 to n do begin

if(i mod 2=0) and (i>=10) then k:=k*i;

end;

writeln(k);

readln;

end.

Cách 2 dùng lệnh while do

Uses crt;

var m,n,o: integer;

begin clrcsr;

readln(n);

o:=1;

m:=1;

while (m<n) do begin

m:=m+1;

if(m mod 2=0) and (m>=10) then o:=o*m;

end;

writeln(o);

readln;

end.

Bình luận (0)
Trường Nguyễn
Xem chi tiết
Minh Lệ
1 tháng 4 2022 lúc 11:26

Program HOC24;

var i,n: integer;

S: real;

begin

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

s:=0;

for i:=1 to N do s:=s+1/i;

write('S= ',s:5:2);

readln

end.

Bình luận (0)
Khánh Hoàng
Xem chi tiết
Thanh Phong (9A5)
6 tháng 3 2023 lúc 18:09

Uses crt;

var s,n,i: integer;

begin clrscr;

readln(n);

for i:=1 to n do if(n mod 2<>0) then s:=s+i;

writeln(s);

readln;

end.

Bình luận (3)
Nguyễn Khải Minh
Xem chi tiết
Kiều Vũ Linh
30 tháng 4 2022 lúc 7:22

Var a:array[1..15] of integer;

i,s:integer;

Begin

I:=1;

While i<=15 do

Begin

Write('Nhap phan tu thu ',i,' = ');readln(a[i]);

s:=s+a[i];

i:=i+1;

End;

Write('Tong la ',s);

Readln;

End.

Bình luận (0)