Những câu hỏi liên quan
Nguyễn Hồng Anh
Xem chi tiết
Nguyễn Hồng Anh
Xem chi tiết
phạm hải nam
Xem chi tiết
Nguyễn Lê Phước Thịnh
14 tháng 3 2022 lúc 9:46

#include <bits/stdc++.h>

using namespace std;

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

int main()

{

cin>>n;

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

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

cout<<endl;

t=0;

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

cout<<t;

return 0;

}

Bình luận (0)
Thảo Nguyễn
Xem chi tiết
Nguyễn Lê Phước Thịnh
24 tháng 12 2021 lúc 10:41

#include <bits/stdc++.h>

using namespace std;

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

int main()

{

cin>>n;

t=0;

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

{

cin>>a[i];

t=t+a[i];

}

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

cout<<endl;

dem=0;

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

if (a[i] %2==0) dem++;

cout<<dem<<endl;

cout<<t;

return 0;

}

Bình luận (0)
Nguyễn Mỹ
Xem chi tiết
nguyễn an phát
5 tháng 4 2021 lúc 18:23

Bài 1:

program in_phan_tu;

uses crt;

var n,i:longint;

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

begin

clrscr;

write('nhap so n:');readln(n);

for i:=1 to n do

begin

write('nhap phan tu a[',i,']:');readln(a[i]);

end;

for i:=1 to n do

write(a[i]:3);

readln;

end.

Bài 2:

program tong_phan_tu;

uses crt;

var n,i,tong:longint;

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

begin

clrscr;

write('nhap so n:');readln(n);

for i:=1 to n do

begin

write('nhap phan tu a[',i,']:');readln(a[i]);

end;

tong:=0;

for i:=1 to n do

tong:=tong+a[i];

writeln('tong cua day la:');

readln;

end.

Bài 3:

program tong_phan_tu_chan;

uses crt;

var n,i,tong:longint;

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

begin

clrscr;

write('nhap so n:');readln(n);

for i:=1 to n do

begin

write('nhap phan tu a[',i,']:');readln(a[i]);

end;

tong:=0;

for i:=1 to n do

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

writeln('tong cua day la:');

readln;

end.

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

Câu 1: 

uses crt;

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

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

readln;

end.

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

Câu 2: 

uses crt;

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

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

 t:=t+a[i];

writeln(t);

readln;

end.

Bình luận (0)
Huy Hoàng Phạm
Xem chi tiết
Nguyễn Lê Phước Thịnh
20 tháng 12 2021 lúc 8:06

#include <bits/stdc++.h>

using namespace std;

long long n,i,a[10000];

int main()

{

cin>>n;

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

cin>>a[i];

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

return 0;

}

Bình luận (0)
Benny
Xem chi tiết
Nguyễn Lê Phước Thịnh
9 tháng 3 2023 lúc 14:55

6:

#include <bits/stdc++.h>

using namespace std;

int main()

{

int n,A[100],i,dem=0;

cin>>n;

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

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

if (A[i]%2!=0) dem++;

cout<<dem;

return 0;

}

5:

#include <bits/stdc++.h>

using namespace std;

int main()

{

long long n,nn=1e6,A[1000];

cin>>n;

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

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

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

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

if (nn==A[i]) cout<<i<<" ";

return 0;

}

Bình luận (0)
Nguyễn Hồng Anh
Xem chi tiết
Nguyễn Hồng Anh
Xem chi tiết