Những câu hỏi liên quan
Phạm Công Ngọc Quốc
Xem chi tiết
Phạm Công Ngọc Quốc
26 tháng 4 2022 lúc 21:23

giúp mik với mai thi mik thi rồi🙏🙏

 

Bình luận (0)
Thế Thôi
26 tháng 4 2022 lúc 22:48

program b1;
uses crt;
var i: integer; a:array[1..100] of integer; s:longint;
begin
clrscr;
for i:=1 to 10 do
begin
write('a[',i,']='); readln(a[i]);
end;
writeln('cac phan tu chan la:');
s:=0;
for i:=1 to 10 do if a[i] mod 2=0 then writeln(a[i],' ');
write('Tong cac phan tu le la:');
for i:=1 to 10 do if a[i] mod 2<>0 then s:=s+a[i]; write(s);
readln;
end.

Tham khảo!

Bình luận (0)
Mai Phương Lê
Xem chi tiết
Nguyễn Lê Phước Thịnh
5 tháng 5 2021 lúc 13:14

Bài 1: 

uses crt;

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

i,n:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

write('A[',i,']='); readln(a[i]);

end;

for i:=1 to n do 

  if a[i] mod 2<>0 then write(a[i]:4);

readln;

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
5 tháng 5 2021 lúc 13:14

Bài 2: 

uses crt;

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

i,n:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

write('A[',i,']='); readln(a[i]);

end;

for i:=1 to n do

  if a[i] mod 2=0 then write(a[i]:4);

readln;

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
5 tháng 5 2021 lúc 13:14

Bài 3: 

uses crt;

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

i,n,t:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

write('A[',i,']='); readln(a[i]);

end;

t:=0;

for i:=1 to n do 

  if a[i] mod 2<>0 then t:=t+a[i];

writeln(t);

readln;

end.

Bình luận (0)
Sarah Lilia
Xem chi tiết
Nguyễn Lê Phước Thịnh
17 tháng 2 2021 lúc 20:53

uses crt;

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

i,n,dem,dem1,dem2,t:integer;

s:real;

begin

clrscr;

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

for i:=1 to n do 

begin

repeat

write('A[',i,']='); readln(a[i]);

until a[i]>0;

end;

for i:=1 to n do 

  write(a[i]:4);

writeln;

dem:=0;

for i:=1 to n do

  if a[i]>10 then inc(dem);

writeln('So phan tu lon hon 10 la: ',dem);

dem1:=0;

dem2:=0;

for i:=1 to n do 

begin

if a[i] mod 2=0 then inc(dem1)

else inc(dem2);

end;

writeln('So luong so chan la: ',dem1);

writeln('So luong so le la: ',dem2);

t:=0;

s:=1;

for i:=1 to n do 

  begin

if (i mod 2=0) and (a[i] mod 2<>1) then t:=t+a[i];

if (i mod 2=1) and (a[i] mod 2=0) then s:=s*a[i];

end;

writeln('Tong cac so o vi tri chan co gia tri le la: ',t);

writeln('Tich cac so o vi tri le co gia tri chan la: ',s:4:2);

writeln('Cac so le la: ');

for i:=1 to n do 

  if a[i] mod 2<>0 then write(a[i]:4);

writeln;

writeln('Cac so chan va lon hon 10 la: ');

for i:=1 to n do 

  if (a[i] mod 2=0) and (a[i]>10) then write(a[i]:4);

readln;

end.

Bình luận (1)
minh dương
Xem chi tiết
Nguyễn Thái Phương Thảo
Xem chi tiết
Phạm Tuấn Kiệt
Xem chi tiết
Minh Lệ
2 tháng 5 2023 lúc 21:09

Program HOC24;

var d,i,n: integer;

t: real;

begin

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

for i:=1 to n do 

begin

write('Nhap so thu ',i,': '); readln(a[i]);

end;

d:=0; t:=0;

for i:=1 to n do

if a[i] mod 2=0 then 

begin

d:=d+1;

t:=t+a[i];

end;

t:=t/d;

writeln('Co ',d,' so chan trong mang');

writeln('Trung binh cong cac phan tu chan la: ',t:2:5);

write('Cac phan tu trong day theo chieu doc: ');

for i:=1 to n do writeln(a[i]);

readln

end.

Bình luận (0)
Hồ Thị Ngọc Vy
Xem chi tiết
HT.Phong (9A5)
10 tháng 4 2023 lúc 14:27

Uses crt;

var max,min,n,i,m,n: longint;

a: array[1..100] of longint

begin clrscr;

for i:=1 to n do begin

if(a[i] mod 2=0) then m:=m+a[i];

if(a[i] mod 2<>0) then n:=n+a[i];

end;

max:=a[1];

min:=a[1];

for i:=1 to n do begin

if(max<a[i]) then max:=a[i];

if(min>a[i]) then min:=a[i];

end;

Writeln('Tong cac phan tu chan: ',m);

Writeln('Tong cac phan tu le: ',n);

Writeln('Phan tu co gia tri lon nhat: ',max);

Writeln('Phan tu co gia tri nho nhat: ',min);

readln;

end.

Bình luận (0)
Hồ Thị Ngọc Vy
Xem chi tiết
HT.Phong (9A5)
11 tháng 4 2023 lúc 11:29

Uses crt;

var max,min,n,i,m,n: longint;

a: array[1..100] of longint

begin clrscr;

for i:=1 to n do begin

if(a[i] mod 2=0) then m:=m+a[i];

if(a[i] mod 2<>0) then n:=n+a[i];

end;

max:=a[1];

min:=a[1];

for i:=1 to n do begin

if(max<a[i]) then max:=a[i];

if(min>a[i]) then min:=a[i];

end;

Writeln('Tong cac phan tu chan: ',m);

Writeln('Tong cac phan tu le: ',n);

Writeln('Phan tu co gia tri lon nhat: ',max);

Writeln('Phan tu co gia tri nho nhat: ',min);

readln;

end.

Bình luận (0)
nhannhan
Xem chi tiết
Phạm Thị Kim Anh
Xem chi tiết
Nguyễn Lê Phước Thịnh
20 tháng 4 2022 lúc 17:09

uses crt;

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

i,n,t,kt,j:integer;

begin

clrscr;

readln(n);

for i:=1 to n do readln(a[i]);

t:=0;

for i:=1 to n do 

if a[i] mod 2<>0 then t:=t+a[i];

writeln(t);

for i:=1 to n do 

  if trunc(sqrt(a[i]))=sqrt(a[i]) then write(a[i]:4);

writeln;

for i:=1 to n do 

  if a[i]>1 then 

begin

kt:=0;

for j:=2 to trunc(sqrt(a[i])) do 

  if a[i] mod j=0 then kt:=1;

if kt=0 then write(a[i]:4);

end;

readln;

end.

Bình luận (0)