Những câu hỏi liên quan
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)
Nguyễn Anh Quân
Xem chi tiết
Trần Nguyễn Huỳnh
Xem chi tiết
Bùi Anh Tuấn
7 tháng 3 2021 lúc 21:13

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

Bình luận (0)
ĐOÀN ĐỨC ANH
Xem chi tiết
ĐOÀN ĐỨC ANH
4 tháng 5 2022 lúc 20:08

giúp mình với

Bình luận (0)
huynh chinh
Xem chi tiết
Nguyễn Lê Phước Thịnh
4 tháng 4 2022 lúc 21:49

#include <bits/stdc++.h>

using namespace std;

long long a[1000],n,i;

int main()

{

freopen("dayd.inp","r",stdin);

freopen("dayd.out","w",stdout);

cin>>n;

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

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

if (a[i]>0) cout<<a[i]<<" ";

return 0;

}

Bình luận (0)
huynh chinh
Xem chi tiết
Nguyễn Lê Phước Thịnh
31 tháng 3 2022 lúc 22:48

#include <bits/stdc++.h>

using namespace std;

long long a[10000],i,n,t;

int main()

{

freopen("avg.inp","r",stdin);

freopen("avg.out","w",stdout);

cin>>n;

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

t=0;

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

cout<<fixed<<setprecision(1)<<(t*1.0)/(n*1.0);

return 0;

}

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

Bai 2:

uses crt;

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

i,n,t,nn:integer;

begin

clrscr;

readln(n);

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

nn:=a[1];

for i:=1 to n do

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

write(nn);

readln;

end.

Bình luận (0)
fyujg
Xem chi tiết
Nguyễn Lê Phước Thịnh
2 tháng 2 2021 lúc 13:08

uses crt;

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

i,n,dem,k: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);

dem:=0;

for i:=1 to n do 

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

writeln('Trong day co ',dem,' phan tu co gia tri bang ',k);

readln;

end.

Bình luận (1)
Nguyễn Thái Phương Thảo
Xem chi tiết