Những câu hỏi liên quan
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)
Anh Quynh
Xem chi tiết
Kiều Vũ Linh
27 tháng 4 2023 lúc 17:54

Var array:[1..1000] of integer;

i,n:integer;

Begin

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

For i:=1 to n do

Begin

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

End;

Write('Cac so vua nhap la ');

For i:=1 to n do write(a[i]:8);

Readln

End.

Bình luận (0)
TKT VN
Xem chi tiết
nguyễn an phát
1 tháng 9 2021 lúc 11:21

program bai_1;
uses crt;
var i,n,j,d,dem:word;
begin
  clrscr;
  repeat
    write('nhap n:');readln(n);
    if (n<=0)or(n>=10000)then writeln('so ban nhap khong hop le, ban hay nhap lai:');
  until (n>0)and(n<10000);
  writeln('cac uoc so la so tu nhien cua ',n,' la:');
  for i:=1 to n do
  if n mod i=0 then write(i,'    ');
  writeln;
  dem:=0;
  for i:=2 to n do
  begin
    d:=0;
    for j:=2 to i div 2 do
    if i mod j=0 then inc(d);
    if (d=0)and(n mod i=0)then inc(dem);
  end;
  if dem>0 then writeln('cac uoc so la so nguyen to cua ',n,' la:');
  begin
    d:=0;
    for j:=2 to i div 2 do
    if i mod j=0 then inc(d);
    if (d=0)and(n mod i=0)then write(i,'    ');
  end;
  if dem=0 then write(0);
  readln;
end.

 

Bình luận (0)
Tuấn Kiệt Phạm
Xem chi tiết
Ngọc Nguyễn Thái Khánh
Xem chi tiết
nguyễn an phát
29 tháng 3 2021 lúc 17:24

program tim_tong_va_tich;

uses crt;

var n,i:integer;

tong,tich:longint;

a:array[1..100]of integer;

begin

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

i:=1;tich:=1;tong:=0;

while i<=n do

begin

write('nhap phan tu a[',i,']:');readln(a[i]);

tong:=tong+a[i];tich:=tich+a[i];

i:=i+1;

end;

writeln('tong cua cac so tren la:',tong);

writeln('tich cua cac so tren la:',tich);

readln;

end.

Bình luận (0)
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)
Hoàng Thị Mỹ Phan
Xem chi tiết
lân đinh
Xem chi tiết
Nguyễn Lê Phước Thịnh
11 tháng 5 2021 lúc 10:59

Bài 1: 

uses crt;

var n,t1,t2,t3,i:integer;

begin

clrscr;

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

t1:=0;

t2:=0;

for i:=1 to n-1 do 

  begin

if i mod 2=1 then t1:=t1+i

else t2:=t2+i;

end;

writeln('Tong cac so le nho hon ',n,' la: ',t1);

writeln('Tong cac so chan nho hon ',n,' la: ',t2);

t3:=0;

for i:=1 to 2*n do 

  t3:=t3+i;

writeln('Tong cac so trong day so tu 1 toi 2*',n,' la: ',t3);

readln;

end.

Bình luận (0)