Nguyễn Thu Trang

Những câu hỏi liên quan
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)
Nguyễn Thị Xuân Hiền
Xem chi tiết
Nguyễn Lê Phước Thịnh
30 tháng 12 2020 lúc 12:01

uses crt;

var a:array[1..250]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);

writeln('Vi tri cua no trong mang la: ');

for i:=1 to n do 

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

readln;

end.

Bình luận (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. 

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)
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)
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;

}

Bình luận (0)
Hương Bùi
Xem chi tiết
Nguyễn Lê Phước Thịnh
3 tháng 12 2021 lúc 22:03

#include <bits/stdc++.h>
using namespace std;
const long long maxint=1e6;
long long a[maxint],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;
}

 

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)
TÌNH ĐIÊN DẠI
Xem chi tiết