Những câu hỏi liên quan
my trần
Xem chi tiết
Nguyễn Lê Phước Thịnh
30 tháng 8 2021 lúc 19:15

uses crt;

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

i,n,dem,max,t,min,dem1:integer;

begin

clrscr;

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

for i:=1 to n do 

 begin

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

end;

dem:=0;

max:=-32000;

for i:=1 to n do 

  begin

if a[i] mod 2=0 then 

begin

dem:=dem+1;

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

end;

if dem=0 then writeln('Trong day khong co so chan')

else begin

writeln('So so chan la: ',dem);

writeln('So chan lon nhat la: ',max);

end;

t:=0;

for i:=1 to n do 

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

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

min:=maxint;

dem1:=0;

for i:=1 to n do 

  if a[i] mod 2<>0 then

begin  

inc(dem1);

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

end;

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

else writeln('So le nho nhat la: ',min);

readln;

end. 

Bình luận (0)
Phan uyển nhi
Xem chi tiết
Nguyễn Lê Phước Thịnh
28 tháng 2 2022 lúc 9:53

#include <bits/stdc++.h>

using namespace std;

long long a[1000],i,n,nn;

int main()

{

cin>>n;

for (i=1; i<=n; i++) cin>>a[i];

nn=a[1];

for (i=1; i<=n; i++) nn=min(nn,a[i]);

cout<<nn<<endl;

for (i=1; i<=n; i++) if (nn==a[i]) cout<<i<<" ";

return 0;

}

Bình luận (0)
Hằng Võ Thanh
Xem chi tiết
Minh Lệ
4 tháng 5 2022 lúc 6:13

Program HOC24;

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

i,n,max: integer;

begin

for i:=1 to n do

begin

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

end;

t:=a[1];

for i:=2 to n do if a[i]>max then max:=a[i];

writeln('So lon nhat trong mang la: ',max);

write('Vi tri cua cac phan tu do la: ');

for i:=1 to n do if a[i]=max then write(i,' );

readln

end.

Bình luận (0)
taf.amp
Xem chi tiết
Kiều Vũ Linh
2 tháng 5 2022 lúc 7:52

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.

Bình luận (0)
taf.amp
Xem chi tiết
Kiều Vũ Linh
2 tháng 5 2022 lúc 7:50

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.

Bình luận (0)
Thi Đua Khen Thưởng
Xem chi tiết
Nguyễn Lê Phước Thịnh
25 tháng 3 2021 lúc 19:18

uses crt;

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

i,n,t,min,vt: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 3=0 then t:=t+a[i];

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

min:=a[1];

for i:=1 to n do 

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

vt:=1;

for i:=1 to n do 

  if min=a[i] then 

begin

if vt<i then vt:=i;

end;

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

writeln('Vi tri la: ',vt);

readln;

end. 

Bình luận (0)
Vương Thị Minh Tâm
Xem chi tiết
vũ minh nhật
1 tháng 1 2022 lúc 12:23

a

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

#include <bits/stdc++.h>

using namespace std;

long long a[1000],i,n;

int main()

{

cin>>n;

for (i=1; i<=n; i++) cin>>a[i];

for (i=1; i<=n; i++) cout<<a[i]<<" ";

return 0;

}

Bình luận (0)
Phương Vũ Hà
Xem chi tiết
Nguyễn Lê Phước Thịnh
1 tháng 3 2021 lúc 17:19

uses crt;

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

n,i,k,max,min,t:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

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

max:=a[1];

for i:=1 to n do 

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

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

writeln('Vi tri la: ');

for i:=1 to n do 

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

writeln;

min:=a[1];

for i:=1 to n do

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

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

writeln('Vi tri la: ');

for i:=1 to n do

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

writeln;

t:=0;

for i:=1 to n do 

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

writeln('Tong binh phuong cac gia tri o vi tri chan la: ',t);

readln;

end. 

Bình luận (0)
Thọ Lê Đức
Xem chi tiết
Kiều Vũ Linh
28 tháng 4 2023 lúc 16:09

Bài 23

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

i,n:integer;

s,tbc:real;

begin

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

for i:=1 to n do

begin

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

s:=s+a[i];

end;

tbc:=s/n;

writeln('Gia tri trung binh la ',tbc:10:2);

write('Cac so lon hon gia tri trung binh la: ');

for i:=1 to n do

if a[i] > tbc then write(a[i]:8);

readln

end.

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

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

i,n,max:integer;

begin

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

for i:=1 to n do

begin

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

end;

max:=a[1];

for i:=2 to n do

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

for i:=1 to n do

begin

if max=a[i] then write(max,' o vi tri thu ',i);

break;

readln

end.

Bình luận (0)