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
QUANH
Xem chi tiết
Trung Kien
Xem chi tiết
Nguyễn Lê Phước Thịnh
17 tháng 3 2021 lúc 21:42

2: 

uses crt;

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

n,i: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]<0 then write(i:4);

readln;

end.

Nguyễn Phương
24 tháng 3 2021 lúc 23:42

sao bài này giống bài tập cô mình giao thế nhỉ:>

 

Lâm Thảo Như
5 tháng 5 2021 lúc 19:14

var max,min,n,i: integer;

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

begin

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

for i:=1 to n do

begin

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

end;

max:=a[1];min:=a[1];

for i:=1 to n do

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

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

write('so lon nhat trong day la: ',max);writeln;

write('so nho nhat trong day la: ',min);writeln;

readln;

end.

Hà phương
Xem chi tiết
Nguyễn Lê Phước Thịnh
24 tháng 12 2021 lúc 9:07

#include <bits/stdc++.h>

using namespace std;

long long a[6],i,t,t1;

int main()

{

t=0;

for (i=1; i<=n; i++)

{

cin>>a[i];

if (a[i]%2==0) t=t+a[i];

}

t1=0;

for (i=1; i<=n; i++)

if ((a[i]%2!=0) and (i%2==0)) t1=t1+a[i];

cout<<t<<endl;

cout<<t1;

return 0;

}

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. 

Trần Nguyễn Huỳnh
Xem chi tiết
Bùi Anh Tuấn
7 tháng 3 2021 lúc 21:13

Nguyễn Lê Phước Thịnh
7 tháng 3 2021 lúc 22:06

uses crt;

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

i,n,max:integer;

begin

clrscr;

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

for i:=1 to n do 

begin

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

end;

max:=a[1];

for i:=1 to n do 

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

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

write('Vi tri la: ');

for i:=1 to n do 

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

readln;

end.

Hương Giang
Xem chi tiết
Nguyễn Lê Phước Thịnh
4 tháng 4 2022 lúc 7:17

uses crt;

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

i,n,t,dem:integer;

begin

clrscr;

readln(n);

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

t:=0;

for i:=1 to n do t:=t+a[i];

writeln(tb/n:4:2);

dem:=0;

for i:=1 to n do 

 if i mod 2=0 then dem:=dem+1;

writeln(dem);

readln;

end.

Lê Thị Hồng anh
Xem chi tiết
Nguyễn Lê Phước Thịnh
14 tháng 2 2022 lúc 21:29

#include <bits/stdc++.h>

using namespace std;

long long a[40],i,n,ln;

int main()

{

cin>>n;

for (i=1; i<=n; i++)

{

cin>>a[i];

}

ln=a[1];

for (i=1; i<=n; i++) ln=max(ln,a[i]);

for (i=n; i>=1; i--)

if (ln==a[i]) 

{

cout<<i;

break;

}

return 0;

}

HSNK HSG
Xem chi tiết
Nguyễn Lê Phước Thịnh
30 tháng 10 2021 lúc 0:01

uses crt;

var a:array[1..50]of int64;

i,n,t,max,min:int64;

begin

clrscr;

readln(n);

for i:=1 to n do 

  readln(a[i]);

max:=a[1];

min:=a[1];

t:=0;

for i:=1 to n do 

begin

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

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

t:=t+a[i];

end;

writeln('Tong la: ',t);

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

write('Vi tri la: ');

for i:=1 to n do

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

writeln;

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

write('Vi tri la: ');

for i:=1 to n do 

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

readln;

end.

Bảo Lê Nguyễn Vũ
Xem chi tiết
Nguyễn Lê Phước Thịnh
18 tháng 1 2022 lúc 22:10

#include <bits/stdc++.h>

using namespace std;

long long a[100],n,i,ln,nn,vt1,vt2;

int main()

{

cin>>n;

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

ln=a[1];

nn=a[1];

for (i=1; i<=n; i++)

{

ln=max(ln,a[i]);

nn=min(nn,a[i]);

}

cout<<ln<<" "<<nn;

return 0;

}

Kiều Vũ Linh
19 tháng 1 2022 lúc 8:08

Var n,i,vtl,vtn,so max,min:integer;

Begin

Write('Nhap so luong so = ');readln(n);

vtl:=0;

vtn:=0;

max:=-32768;

min:=32767;

For i:=1 to n do

Begin

Write('Nhap vao so thu ',i);readln(so);

If so > max then

Begin

Max:=so;

vtl:=i;

End;

If so < min then

Begin

Min:=so;

vtn:=i;

End;

Writeln('So lon nhat la ',max,' tai vi tri thu ',i);

Write('So nho nhat la ',min,' tai vi tri thu ',i);

Readln;

End.