Những câu hỏi liên quan
Yuki
Xem chi tiết
Vũ Quang Huy
11 tháng 5 2022 lúc 0:35

tham khảo'

 

uses crt;

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

i,n,t,dem:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

t:=0;

dem:=0;

for i:=1 to n do 

  if a[i] mod 2=0 then

begin

t:=t+a[i];

inc(dem);

end;

writeln('Tong cac so chan la: ',t);

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

readln;

end.

Bình luận (0)
Kiều Vũ Linh
11 tháng 5 2022 lúc 7:49

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

i,n,dem,vt,s sc,sl,min:integer;

tbc:real;

Begin

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

For i:=1 to n do

Begin

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

End;

For i:=1 to n do s:=s+a[i];

tbc:=s/n;

Writeln('Gia tri trung binh cua mang la ',tbc:10:2);

Write('Cac phan tu lon hon gia tri trung binh la ');

For i:=1 to n do

If a[i]>tbc then write(a[i],'   ');

For i:=1 to n do

Begin

If a[i] mod 2 = 0 then sc:=sc+a[i]

Else sl:=sl+a[i];

End;

Writeln('Tong cac phan tu chan la ',sc);

Writeln('Tong cac phan tu le la ',sl);

min:=a[1];

For i:=2 to n do

Begin

If a[i] < min then min:=a[i];

vt:=i;

End;

Writeln('Phan tu nho nhat la ',min,' tai vi tri ',vt);

For i:=1 to n do

If a[i] mod 5 = 0 then dem:=dem+1;

Write('So cac phan tu chia het cho 5 la ',dem);

Readln;

End.

Bình luận (0)
Trúc My
Xem chi tiết
Thế Thôi
25 tháng 4 2022 lúc 20:16

program b1;
uses crt;
var i,n: integer; a:array[1..20] of integer; 
begin
clrscr;
for i:=1 to 20 do
begin
write('a[',i,']='); readln(a[i]);
end;
write('Cac phan tu la:');
for i:=1 to 20 do
write(a[i], ' ');
readln;
end.
Tham khảo!

Bình luận (0)
Ánh sao
Xem chi tiết
Nguyễn Lê Phước Thịnh
8 tháng 4 2021 lúc 20:15

Câu 1: 

uses crt;

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

max,i:integer;

begin

clrscr;

for i:=1 to 5 do 

  begin

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

end;

max:=a[1];

for i:=1 to 5 do 

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

writeln(max);

readln;

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
8 tháng 4 2021 lúc 20:16

Câu 2: 

uses crt;

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

min,i:integer;

begin

clrscr;

for i:=1 to 6 do 

  begin

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

end;

min:=a[1];

for i:=1 to 6 do 

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

writeln(min);

readln;

end.

Bình luận (0)
Lê Quang Huy
Xem chi tiết
Luân Đào
30 tháng 12 2020 lúc 6:00

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

n,i: integer;

tb: real;

begin

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

for i:=1 to n do 

begin

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

end;

tb:=0;

for i:=1 to n do

tb:=tb+a[i];

tb:=tb/n;

for i:=1 to n do 

if a[i] > tb then writeln(a[i]);

readln

end.

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)
Lê Tuấn Lâm
Xem chi tiết
Nguyễn Lê Phước Thịnh
11 tháng 3 2022 lúc 15:57

#include <bits/stdc++.h>

using namespace std;

long long x,n,i,nn,t;

int main()

{

cin>>n;

nn=LLONG_MAX;

t=0;

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

{

cin>>x;

t+=x;

nn=min(nn,x);

}

cout<<nn<<" "<<t;

return 0;

}

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)
Nguyên lê
Xem chi tiết
Kiều Vũ Linh
5 tháng 5 2023 lúc 5:56

Var array:[1..1000] of integer;

i,n:integer;

Begin

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

For i:=1 to n do

Begin

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

End;

Write('Cac so le la ');

For i:=1 to n do

If a[i] mod 2 <> 0 then write(a[i]:8);

Readln

End.

Bình luận (0)
Vũ Hạ Linh
Xem chi tiết
Nguyễn Lê Phước Thịnh
7 tháng 5 2021 lúc 21:10

Câu 1: 

a) var a:array[1..50]of real;

b) a[5]:=8;

c) for i:=1 to 50 do  

begin

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

end;

for i:=1 to 50 do 

 write(a[i]:4);

 

Bình luận (0)
Nguyễn Lê Phước Thịnh
7 tháng 5 2021 lúc 21:10

Câu 2: 

uses crt;

var s,i:integer;

begin

clrscr;

s:=0;

for i:=1 to 10 do 

  s:=s+i;

writeln(s);

readln;

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
7 tháng 5 2021 lúc 21:11

Câu 3: 

b) a[2]=37

a[9]=25

Bình luận (0)