Những câu hỏi liên quan
nguyễn bảo nga
Xem chi tiết
Nguyễn Lê Phước Thịnh
12 tháng 1 2022 lúc 22:25

#include <bits/stdc++.h>

using namespace std;

long long i,n;

double s;

int main()

{

cin>>n;

s=0;

for (i=1; i<=n; i++)

 s=s+((1*1.0)/(2*(i*1.0+1*1.0)));

 cout<<fixed<<setprecision(2)<<s;

return 0;

}

Gia Linh
Xem chi tiết
Lâm Khả Doanh
Xem chi tiết
Nguyễn Lê Phước Thịnh
28 tháng 2 2023 lúc 22:28

1:

uses crt;

var n,i,t:integer;

begin

clrscr;

readln(n);

t:=0;

for i:=1 to n do

t:=t+i*i;

write(t);

readln;

end.

Lê Chiêu Nguyên	Vũ
4 tháng 4 2023 lúc 10:21

2

program bt2;

var i,n,t:integer;

begin

readln(n);

s:=0;

for i:=1 to n do

if i mod 2 = 1 then s:=s+i;

readln;

end.

NGUYỄN LÊ XUÂN THỊNH
Xem chi tiết
Nguyễn Lê Phước Thịnh
20 tháng 2 2023 lúc 0:38

Câu 6:

uses crt;

var n,i:integer;

begin

clrscr;

readln(n);

for i:=1 to n do 

if n mod i=0 then write(i:4);

readln;

end.

5:

uses crt;

var n,i,dem:integer;

begin

clrscr;

readln(n);

dem:=0;

for i:=0 to n do

if i mod 2=1 then 

begin

write(i:4);

dem:=dem+1;

end;

writeln;

writeln(dem);

readln;

end.

Gia Hân
Xem chi tiết
Minh Lệ
1 tháng 3 2021 lúc 21:03

Program HOC24;

var n,i: integer;

s: longint;

begin

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

s:=2021;

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

write('S= ',s);

readln

end.

Nguyễn Lê Phước Thịnh
1 tháng 3 2021 lúc 21:22

*Cách 2: Dùng While do

uses crt;

var s,i,n:integer;

begin

clrscr;

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

s:=2021;

i:=0;

while i<=n do 

  begin

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

i:=i+1;

end;

writeln(s);

readln;

end.

nana
Xem chi tiết
Như Ý
Xem chi tiết
Phía sau một cô gái
1 tháng 5 2023 lúc 19:27

Câu 1:

program Tinhtong:

var

     n, i, sum: integer;

begin

     write('Nhap n: ');

     readln(n);

     sum := 0;

     for i := 2 to n do

     begin

          if i mod 2 = 0 then

          begin

               sum := sum + i;

          end;

     end;

     writeln('Tong cac so chan tu 2 toi ', n, ' la ', sum);

     readln; 

end.

Câu 2:

program Tinhtong:

var

     n, i, sum: integer;

begin

     write('Nhap n: ');

     readln(n);

     sum := 0;

     for i := 1 to n do

     begin

          if i mod 2 = 1 then

          begin

               sum := sum + i;

          end;

     end;

     writeln('Tong cac so le tu 1 toi ', n, ' la ', sum);

     readln;

end.

Nguyễn Huy Bảo Thạch
Xem chi tiết
Kim Anh
Xem chi tiết
Kim Anh
21 tháng 2 2022 lúc 14:35

Cái này là chương trình Python nha mọi người

Quý Phạm
Xem chi tiết
Kiều Vũ Linh
20 tháng 3 2023 lúc 12:22

Var i,n:integer;

s:longint;

Begin

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

For i:=1 to n do

s:=s + 2*i;

Write('Tong la ',s);

Readln;

End.