Những câu hỏi liên quan
Hoàng lĩnh
Xem chi tiết
Kiều Vũ Linh
20 tháng 3 2023 lúc 12:20

Var i,n:integer;

s:longint;

Begin

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

For i:=1 to n-1 do

If (i mod 2 = 0) and (i mod 3 = 0) then

s:=s + i;

Write('Tong la ',s);

Readln;

End.

Bình luận (0)
Yna Lolipop
Xem chi tiết
Nguyễn Lê Phước Thịnh
2 tháng 3 2022 lúc 23:11

1:

#include <bits/stdc++.h>

using namespace std;

long long dem,i,n,x;

int main()

{

cin>>n;

dem=0;

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

{

cin>>x;

if (x%2==0) dem++;

}

cout<<dem;

return 0;

}

Câu 2: 

#include <bits/stdc++.h>

using namespace std;

long long x,n,i,t;

int main()

{

cin>>n;

t=0;

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

{

cin>>x;

if (x%3==0) t+=x;

}

cout<<t;

return 0;

}

Bình luận (0)
Đỗ Trọng TÍn
Xem chi tiết
Kiều Vũ Linh
29 tháng 4 2023 lúc 7:52

Câu 3:

Var i,n:integer:

Begin

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

Write('Cac uoc cua n la ');

For i:=1 to n do

If n mod i = 0 then write(i:8);

Readln

End.

Bình luận (0)
Kiều Vũ Linh
29 tháng 4 2023 lúc 7:56

Câu 4

Var i,n:integer:

Begin

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

Write('Cac so le nho hon n la ');

For i:=1 to n - 1 do

If i mod 2 <> 0 then write(i:8);

Readln

End.

Bình luận (1)
Phan Thị Ka
Xem chi tiết
Minh Lệ
19 tháng 3 2023 lúc 22:40

Câu 1:

Program HOC24;

var i,p: integer;

t: longint;

begin

write('Nhap P: '); readln(p);

t:=0;

for i:=1 to p do if i mod 2<>0 then t:=t+i;

write('Tong cac so le la: ',t);

readln

end.

Bình luận (0)
Minh Lệ
19 tháng 3 2023 lúc 22:41

Câu 2:

Program HOC24;

var i,n: integer;

t: longint;

begin

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

t:=0;

for i:=1 to n do if i mod 2=0 then t:=t+i;

write('Tong cac so chan la: ',t);

readln

end.

Bình luận (0)
Minh Lệ
19 tháng 3 2023 lúc 22:42

Câu 3:

Program HOC24;

var i,t,n: integer;

begin

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

t:=0;

for i:=1 to n do if n mod i=0 then t:=t+i;

write('Tong cac uoc cua ',n,' la: ',t);

readln

end.

Bình luận (0)
Phan Chí Huy
Xem chi tiết
Nguyễn Lê Phước Thịnh
17 tháng 1 2023 lúc 1:32

uses crt;

var i,n,t:integer;

begin

clrscr;

readln(n);

t:=0;

for i:=1 to n do

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

write(t);

readln;

end.

Bình luận (0)
Nguyễn Kim Đan
Xem chi tiết
Nguyễn Lê Phước Thịnh
21 tháng 2 2023 lúc 15:37

uses crt;

var n,i,t:integer;

begin

clrscr;

readln(n);

t:=0;

for i:=1 to n do

if i mod 2=0 then t:=t+i;

write(t);

readln;

end.

Bình luận (0)
Nguyễn Thị Tươi
Xem chi tiết
Alice
Xem chi tiết
Đỗ Trọng TÍn
Xem chi tiết