Những câu hỏi liên quan
nguyễn xuân hoàng tùng
Xem chi tiết
Dương
Xem chi tiết
Nguyễn Lê Phước Thịnh
19 tháng 10 2021 lúc 23:30

a: 

#include <bits/stdc++.h>

using namespace std;

long long n,i,x,t;

int main()

{

cin>>n;

t=0;

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

{

cin>>x;

t=t+x;

}

cout<<t;

return 0;
}

Bình luận (0)
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)
Tú Đức
Xem chi tiết
Nguyễn Lê Phước Thịnh
14 tháng 2 2022 lúc 21:41

#include <bits/stdc++.h>

using namespace std;

long long a[10000],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 (1)
Thi Đua Khen Thưởng
Xem chi tiết
Nguyễn Lê Phước Thịnh
25 tháng 3 2021 lúc 19:18

uses crt;

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

i,n,t,min,vt:integer;

begin

clrscr;

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

for i:=1 to n do 

begin

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

end;

t:=0;

for i:=1 to n do 

  if a[i] mod 3=0 then t:=t+a[i];

writeln('Tong cac so chia het cho 3 la: ',t);

min:=a[1];

for i:=1 to n do 

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

vt:=1;

for i:=1 to n do 

  if min=a[i] then 

begin

if vt<i then vt:=i;

end;

writeln('Gia tri nho nhat la: ',min);

writeln('Vi tri la: ',vt);

readln;

end. 

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

Bình luận (2)
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ỉ:>

 

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

Bình luận (0)
erddedfrferf ffvf fd
Xem chi tiết
Nguyễn Lê Phước Thịnh
15 tháng 2 2022 lúc 16: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];

for (i=1; i<=n; i++) if (a[i]%2!=0) cout<<i<<" ";

cout<<endl;

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 (2)
HSNK HSG
Xem chi tiết
Nguyễn Lê Phước Thịnh
30 tháng 10 2021 lúc 0:01

uses crt;

var a:array[1..50]of int64;

i,n,t,max,min:int64;

begin

clrscr;

readln(n);

for i:=1 to n do 

  readln(a[i]);

max:=a[1];

min:=a[1];

t:=0;

for i:=1 to n do 

begin

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

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

t:=t+a[i];

end;

writeln('Tong la: ',t);

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

write('Vi tri la: ');

for i:=1 to n do

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

writeln;

writeln('So nho nhat la: ',min);

write('Vi tri la: ');

for i:=1 to n do 

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

readln;

end.

Bình luận (0)
Không Tên
Xem chi tiết
Nguyễn Lê Phước Thịnh
5 tháng 1 2021 lúc 20:39

uses crt;

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

i,n,min,dem: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];

dem:=0;

for i:=1 to n do 

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

writeln('So phan tu co gia tri nho nhat trong day la: ',dem);

readln;

end.

Bình luận (0)
Không Tên
5 tháng 1 2021 lúc 9:18

Mọi người làm nhanh hộ ạ, em đang cần gấp ạ, phiền mọi người ạ

 

Bình luận (0)