K
Khách

Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.

1:

uses crt;

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

i,n,j,m,max,min:integer;

begin

clrscr;

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

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

for i:=1 to n do 

for j:=1 to m do 

begin

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

end;

for i:=1 to n do 

begin

for j:=1 to m do 

  write(a[i,j]:4);

writeln;

end;

max:=a[1];

min:=a[1];

for i:=1 to n do 

  for j:=1 to m do 

begin

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

if min>a[i,j] then min:=a[i,j];

end;

writeln('Gia tri lon nhat la: ',max);

writeln('Gia tri nho nhat la: ',min);

readln;

end.

8 tháng 9 2017

Đáp án đúng : D

uses crt;

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

i,n,dem1,dem2:integer;

begin

clrscr;

readln(n);

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

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

writeln;

dem1:=0;

for i:=1 to n do 

  if (a[i]>a[i-1]) and (a[i]>a[i+1]) then dem1:=dem1+1;

dem2:=0;

for i:=1 to n do 

  if (a[i]<a[i-1]) and (a[i]<a[i+1]) then dem2:=dem2+1;

writeln(dem1);

writeln(dem2);

readln;

end.

uses crt;

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

n,i,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.

uses crt;

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

i,n,min,tam,j:integer;

begin

clrscr;

n:=100;

for i:=1 to 100 do 

  begin

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

end;

min:=a[1];

for i:=1 to n do

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

writeln('Gia tri nho nhat la: ',min);

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 so tang dan la: ');

for i:=1 to n do 

  write(a[i]:4);

readln;

end.

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

i,n:integer;

begin

clrscr;

readln(n);

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

readln;

end.

Câu 1:

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

Câu 2: 

uses crt;

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

i:integer;

begin

clrscr;

for i:=1 to 10 do 

  begin

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

end;

for i:=1 to 10 do 

 write(a[i]:4);

readln;

end.

Câu 3: 

uses crt;

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

i,n,t:integer;

begin

clrscr;

repeat

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

until (0<n) and (n<=15);

for i:=1 to n do 

begin

repeat

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

until a[i]<=100;

end;

writeln('Mang da nhap la: ');

for i:=1 to n do 

  write(a[i]:4);

writeln;

t:=0;

for i:=1 to n do

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

writeln('Tong cac phan tu chia het cho 3 la: ',t);

writeln('Cac so chan o vi tri le trong day la: ');

for i:=1 to n do 

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

readln;

end.

uses crt;

var b:array[1..25]of integer;

i,n:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

write('B[',i,']='); readln(b[i]);

end;

readln;

end.

2 tháng 5 2022

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

i,n,d,max:integer;

Begin

Write('Nhap so luong phan tu cua mang ');readln(n);

For i:=1 to n do

Begin

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

End;

max:=a[1];

For i:=2 to n do

Begin

If a[i] > max then

Begin

max:=a[i];

d:=i;

End;

End;

Write('Phan tu lon nhat la ',max,' o vi tri ',d);

Readln;

End.