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
bui pham phuong Uyen
Xem chi tiết
Nguyễn Lê Phước Thịnh
27 tháng 1 2021 lúc 13:15

Bài 1: 

uses crt;

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

i,n,kt,max,x,j,tam:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

writeln('Mang ban vua nhap la: ');

for i:=1 to n do 

  write(a[i]:4);

writeln;

for i:=1 to n-1 do 

  for j:=i+1 to n do 

if a[i]>a[j] then 

begin

tam:=a[i];

a[i]:=a[j];

a[j]:=tam;

end;

writeln('Day tang dan la: ');

for i:=1 to n do 

  write(a[i]:4);

writeln;

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

max:=0;

kt:=0;

for i:=1 to n do 

  if (a[i] mod 2=0) and (a[i]<=x) then 

   begin

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

kt:=1;

end;

if kt=0 then writeln('Trong day khong co so le')

else writeln('So chan lon nhat khong vuot qua ',x,' la: ',max);

readln;

end.

vy tường
Xem chi tiết
Bùi Anh Tuấn
4 tháng 5 2021 lúc 20:26

uses crt;
var a: array[1..100] of integer;
i,n,s,s1,s2,s3: integer;
begin
clrscr;
writeln(' nhap so phan tu cua day'); readln(n);

for i:=1 to n do
begin
writeln('a[',i,']'); readln(a[i]);
end;
write('day vua nhap la:');
s:=0;
for i:=1 to n do
begin
write(a[i],' ');
s:=s+a[i];
if a[i] mod 2=0 then s1:=s1+a[i];
if a[i] mod 2<>0 then s2:=s2+a[i];
if a[i] mod 3=0 then s3:=s3+a[i];
end;
writeln;
writeln('tong bang:',s);
writeln('tong chan:',s1);
writeln('tong le:',s2);
writeln('tong chia het cho 3:',s3);
readln
end.

Yết Thiên
Xem chi tiết
nguyễn an phát
12 tháng 5 2021 lúc 14:48
program tinh_tong;

uses crt;

var i,n:integer;

t:longint;

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

begin

clrscr;

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

t:=0;

for i:=1 to n do

begin

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

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

end;

write(t);

readln;

end.

  
Phan Thu
Xem chi tiết
Ngọc Ty
Xem chi tiết
Kiều Vũ Linh
24 tháng 4 2023 lúc 18:56

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

i,n:integer;

s:longint;

Begin

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

For i:=1 to n do

Begin

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

s:=s+a[i];

End;

Write('Cac phan tu vua nhap la ');

For i:=1 to n do

Write(a[i]:8);

Writeln;

Write('Tong cua chung la ',s);

Readln

End.

Huy Hoang Nguyen
Xem chi tiết
Utfg aghjn
Xem chi tiết
Kiều Trang
Xem chi tiết
Nguyen Ng nguyen
Xem chi tiết
Thế Thôi
20 tháng 4 2022 lúc 6:25