Những câu hỏi liên quan
Nguyễn Thùy Linh
Xem chi tiết
Nguyễn Lê Phước Thịnh
14 tháng 4 2022 lúc 22:16

#include <bits/stdc++.h>

using namespace std;

long long a[100],n,i,s,t,ln,nn;

int main()

{

cin>>n;

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

cin>>a[i];

s=1;

t=0;

ln=a[1];

nn=a[1];

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

{

s=s*a[i];

t+=a[i];

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

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

}

cout<<s<<endl;

cout<<t<<endl;

cout<<ln<<endl;

cout<<nn;

return 0;

}

........................
Xem chi tiết
Nguyễn Lê Phước Thịnh
25 tháng 2 2022 lúc 13:24

#include <bits/stdc++.h>

using namespace std;

long long n,i,x,nn;

int main()

{

cin>>n;

nn=LLONG_MAX;

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

{

cin>>x;

nn=min(nn,x);

}

cout<<nn;

return 0;

}

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.

Yến Phạm
Xem chi tiết
Nguyễn Lê Phước Thịnh
25 tháng 5 2022 lúc 10:24

uses crt;

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

i,n,t,ln,nn:integer;

begin

clrscr;

readln(n);

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

ln:=a[1];

nn:=a[1];

t:=0;

for i:=1 to n do 

begin

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

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

t:=t+a[i];

end;

writeln(ln);

writeln(nn);

writeln(t);

for i:=1 to n do 

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

readln;

end.

Bảo Nam
25 tháng 5 2022 lúc 15:36

var n,i,max,min,s: integer;

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

begin

readln(n);

for i:=1 to n do begin

readln(a[i]);

s:=s+a[i];

end;

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

for i:=2 to n do begin

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

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

end;

writeln('MAX=',max,'  | MIN=',min);

for i:=1 to n do if a[i] mod 2=0 then write(a[i],' '); writeln;

write('Tong = ',s);

readln

end.

Duy Tân Đoàn
Xem chi tiết
Nguyễn Công Tuấn
Xem chi tiết
Nguyễn Công Tuấn
25 tháng 12 2020 lúc 22:14

Giúp em mới ạ mai em thi rồi 

nguyễn xuân hoàng tùng
Xem chi tiết
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.

Hồ Thị Ngọc Vy
Xem chi tiết
HT.Phong (9A5)
10 tháng 4 2023 lúc 14:27

Uses crt;

var max,min,n,i,m,n: longint;

a: array[1..100] of longint

begin clrscr;

for i:=1 to n do begin

if(a[i] mod 2=0) then m:=m+a[i];

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

end;

max:=a[1];

min:=a[1];

for i:=1 to n do begin

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

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

end;

Writeln('Tong cac phan tu chan: ',m);

Writeln('Tong cac phan tu le: ',n);

Writeln('Phan tu co gia tri lon nhat: ',max);

Writeln('Phan tu co gia tri nho nhat: ',min);

readln;

end.

Hồ Thị Ngọc Vy
Xem chi tiết
HT.Phong (9A5)
11 tháng 4 2023 lúc 11:29

Uses crt;

var max,min,n,i,m,n: longint;

a: array[1..100] of longint

begin clrscr;

for i:=1 to n do begin

if(a[i] mod 2=0) then m:=m+a[i];

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

end;

max:=a[1];

min:=a[1];

for i:=1 to n do begin

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

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

end;

Writeln('Tong cac phan tu chan: ',m);

Writeln('Tong cac phan tu le: ',n);

Writeln('Phan tu co gia tri lon nhat: ',max);

Writeln('Phan tu co gia tri nho nhat: ',min);

readln;

end.