Những câu hỏi liên quan
Văn Công Sỹ
Xem chi tiết
Văn Công Sỹ
25 tháng 4 2021 lúc 10:28

Làm giúp bài này nhé

 

Bình luận (0)
Bùi Anh Tuấn
25 tháng 4 2021 lúc 19:41

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

uses crt;

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

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

begin

clrscr;

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

for i:=1 to n 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;

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

readln;

end.

Bình luận (0)
Thái Bảo
Xem chi tiết
Nguyễn Lê Phước Thịnh
23 tháng 12 2020 lúc 20:08

uses crt;

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

i,n,tc,tl,t:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

tc:=0;

tl:=0;

for i:=1 to n do 

  begin

if a[i] mod 2=0 then tc:=tc+a[i]

else tl:=tl+a[i];

end;

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

writeln('Tong cac so le la: ',tl);

t:=0;

for i:=1 to n do  

t:=t+a[i];

writeln('Tong cua day so la: ',t);

readln;

end. 

Bình luận (1)
Võ Thái An Bình
Xem chi tiết
Nguyên Hưng Trần
29 tháng 7 2021 lúc 10:42

Bài 1:

Uses crt;

var i,n,j:integer;

     a,b,c:array[1..100000] of integer;

Begin

clrscr;

readln(n);

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

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

j:=0;

for i:= 1 to n do 

  Begin

  inc(j);

  c[j] := a[i];

  inc(j);

  c[j] := b[i];

  end;

for i:= 1 to j do write(c[i],'  ');

readln;

end. 

Bình luận (1)
Đức Vượng
Xem chi tiết
Nguyễn Lê Phước Thịnh
17 tháng 5 2021 lúc 9:49

uses crt;

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

i,n,max,dem: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 

  write(a[i]:4);

writeln;

max:=a[1];

for i:=1 to n do 

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

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

write('Vi tri cua so lon nhat la: ');

for i:=1 to n do 

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

writeln;

dem:=0;

for i:=1 to n do 

  if max=a[i] then inc(dem);

writeln('So luong phan tu lon nhat trong day la: ',dem);

readln;

end. 

Bình luận (0)
Lê Thị Thu Phương
7 tháng 6 2021 lúc 21:18

uses crt;
var a:array[1..100000000] of int64;
      n,i,d,max:longint;
begin
        clrscr;
        repeat
                write('Nhap so luong phan tu: '); readln(n);
                if (n<=0) and (n>688886) then writeln('NHAP LAI!');
        until (n>0) and (n<=688886);
        for i:=1 to n do
                begin
                        write('Nhap phan tu thu ',i,': '); readln(a[i]);
                end;
        write('Day so vua nhap: ');
        for i:=1 to n do write(a[i],' ');
        max:=a[1];
        for i:=1 to n do if a[i]>max then max:=a[i];
        writeln;
        writeln('So lon nhat: ',max);
        write('Vi tri cua cac so lon nhat: ');
        for i:=1 to n do if a[i]=max then begin write(i,' '); inc(d) end;
        writeln;
        writeln('So luong so lon nhat: ',d);
        readln;
end.

Bình luận (0)
Phong Vũ
Xem chi tiết
Nguyễn Lê Phước Thịnh
1 tháng 3 2022 lúc 13:50

#include <bits/stdc++.h>

using namespace std;

long long a[1000],i,n,t,dem;

int main()

{

cin>>n;

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

t=0;

dem=0;

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

if ((a[i]>0) and (i%2==1))

{

t+=a[i];

dem++;

}

cout<<fixed<<setprecision(2)<<(t*1.0)/(dem*1.0);

return 0;

}

Bình luận (0)
Hứa Tiến Mạnh
Xem chi tiết
Nguyễn Lê Phước Thịnh
13 tháng 12 2020 lúc 22:35
uses crt; var i,n,a,b, uc,bcnn:integer ; c:array[1..100] of integer; {--- CTC tim UCLL hai so} function ucln(a,b:integer):integer; var r:integer; begin r:=a mod b; while r<>0 do begin a:=b; b:=r; r:= a mod b; end; ucln:=b; end; {--- CTC chinh----} begin Write('n= '); readln(n); for i:=1 to n do begin write('c[',i,']='); readln(c[i]); end; for i:= 1 to n do Write(c[i]:3);writeln; uc:=ucln(c[1], c[2]); bcnn:=(c[1]*c[2])div uc; for i:=3 to n do begin uc:=ucln(uc,c[i]); bcnn:= bcnn*c[i] div uc; end; Writeln('bcnn =',bcnn); readln; end.
Bình luận (0)
Ngọc Ty
Xem chi tiết
Kiều Vũ Linh
24 tháng 4 2023 lúc 18:56

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

i,n:integer;

s:longint;

Begin

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

For i:=1 to n do

Begin

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

s:=s+a[i];

End;

Write('Cac phan tu vua nhap la ');

For i:=1 to n do

Write(a[i]:8);

Writeln;

Write('Tong cua chung la ',s);

Readln

End.

Bình luận (0)
Hoàng Thị Minh Nguyệt
Xem chi tiết
Sarah Lilia
Xem chi tiết
Nguyễn Lê Phước Thịnh
17 tháng 2 2021 lúc 20:53

uses crt;

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

i,n,dem,dem1,dem2,t:integer;

s:real;

begin

clrscr;

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

for i:=1 to n do 

begin

repeat

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

until a[i]>0;

end;

for i:=1 to n do 

  write(a[i]:4);

writeln;

dem:=0;

for i:=1 to n do

  if a[i]>10 then inc(dem);

writeln('So phan tu lon hon 10 la: ',dem);

dem1:=0;

dem2:=0;

for i:=1 to n do 

begin

if a[i] mod 2=0 then inc(dem1)

else inc(dem2);

end;

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

writeln('So luong so le la: ',dem2);

t:=0;

s:=1;

for i:=1 to n do 

  begin

if (i mod 2=0) and (a[i] mod 2<>1) then t:=t+a[i];

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

end;

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

writeln('Tich cac so o vi tri le co gia tri chan la: ',s:4:2);

writeln('Cac so le la: ');

for i:=1 to n do 

  if a[i] mod 2<>0 then write(a[i]:4);

writeln;

writeln('Cac so chan va lon hon 10 la: ');

for i:=1 to n do 

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

readln;

end.

Bình luận (1)
Ngọc Diệp
Xem chi tiết
nguyễn an phát
12 tháng 5 2021 lúc 20:24

program du_lieu;

uses crt;

var i,n:integer;

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

tbc:real;

f:text;

begin

clrscr;

assign(f,'DULIEU.INP');reset(f);

readln(f,n);

for i:=1 to n do

begin

read(f,a[i]);

end;

close(f);

for i:=1 to n do

tbc:=tbc+a[i];

writeln(tbc/n);

readln;

end.

Bình luận (0)