Bạn chưa đăng nhập. Vui lòng đăng nhập để hỏi bài

Những câu hỏi liên quan
Tùng Dương
Xem chi tiết
nguyễn an phát
27 tháng 5 2021 lúc 13:35

program tong_for_to_do;

uses crt;

var i,n:integer;

t:real;

begin

clrscr;

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

t:=0;

for i:=1 to n do

if i mod 3=0 then t:=t+1/i;

writeln('tong la: ',t);

readln;

end.

nguyễn an phát
27 tháng 5 2021 lúc 13:37

program tong_while_do;

uses crt;

var i,n:integer;

t:real;

begin

clrscr;

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

t:=0;i:=3;

while i<=3*n do

begin

t:=t+1/i;

i:=i+3;

end;

writeln('tong la: ',t);

readln;

end.

Bảo Trâm
Xem chi tiết
Nguyễn Lê Phước Thịnh
6 tháng 4 2022 lúc 23:03

 

 

#include <bits/stdc++.h>

using namespace std;

long long n,i,t;

int main()

{

cin>>n;

t=0;

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

if (i%2!=0) t+=i;

cout<<t;

return 0;

}

 

Phạm thị thảo ly
Xem chi tiết
Đỗ Tuệ Lâm
20 tháng 3 2022 lúc 15:20

undefined

Minh Lệ
20 tháng 3 2022 lúc 18:49

Program HOC24;

var i,n: integer;

S,P: longint;

begin

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

{..............................................}

readln

end.

-----------------------------------------------------------

Bạn điền vào {........................} theo từng bài nhé

a) S:=0; 

for i:=1 to N do if i mod 2=1 then s:=s+i;

write('S= ',s);

b)

S:=0;

for i:=1 to N do if i mod 2=0 then s:=s+i;

write('S= ',s);

c) P:=1;

for i:=1 to N do if i mod 2=0 then p:=p*i;

write('P= ',p);

d)

P:=1;

for i:=1 to N do if i mod 2=1 then p:=p*i;

write('P= ',p);

Ngân
Xem chi tiết
ILoveMath
3 tháng 3 2022 lúc 9:21

For...do:

var s,i: integer;

begin

readln(s,i);

s:=0;

For i:=3 to 99 do

If i mod 3 = 0 do s:=s+i;

write(s)

readln;

end.

while ... do:

Var i,S:integer;

Begin

Readln(i,s);

S:=0;

i:=3;

while i<=99 do

if i mod 3 = 0 then s:=s+i;

write(s);

Readln;

End.

ILoveMath đã xóa
ILoveMath
3 tháng 3 2022 lúc 10:29

For...do:

var s,i: integer;

begin

readln(s,i);

s:=0;

For i:=3 to 99 do

If i mod 3 = 0 do s:=s+i;

write(s);

readln;

end.

while ... do:

Var i,S:integer;

Begin

Readln(i,s);

S:=0;

i:=3;

while i<=99 do

if i mod 3 = 0 then s:=s+i;

write(s);

Readln;

End.

Nguyễn Cảnh Hùng
Xem chi tiết
Đỗ Ngọc Trinh
30 tháng 5 2017 lúc 6:52

Võ Tấn Trường Phạm
Xem chi tiết
Nguyễn Lê Phước Thịnh
9 tháng 3 2023 lúc 15:01

#include <bits/stdc++.h>

using namespace std;

int main()

{

int n,t=0;

cin>>n;

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

if (i%6==0) t+=i;

cout<<t;

return 0;

}

phuong linh
Xem chi tiết
Kiều Vũ Linh
20 tháng 4 2022 lúc 14:57

Var s1,s2,i,j:integer;

Begin

s1:=1;

s2:=0;

i:=2;

j:=4;

While i<=50 do

Begin

s1:=s1+i;

i:=i+2;

End;

While j<=20 do

Begin

s2:=s2+j;

j:=j+4;

End;

s2:=s2+32;

Writeln('Tong day N = ',s1);

Writeln('Tong day M = ',s2);

Readln;

End.

Nguyễn kiên
Xem chi tiết
Bảo Trâm
Xem chi tiết
Nguyễn Lê Phước Thịnh
6 tháng 4 2022 lúc 23:03

#include <bits/stdc++.h>

using namespace std;

long long n,i,t;

int main()

{

cin>>n;

t=0;

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

if (i%2==0) t+=i;

cout<<t;

return 0;

}