K
Khách

Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.

#include <bits/stdc++.h>

using namespace std;

long long a[50],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;

cout<<t;

return 0;

}

30 tháng 4 2023

Program HOC24;

var i,n: byte;

t: longint:

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

begin

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

for i:=1 to n do begin write('A[',i,']='); readln(a[i]); end;

t:=0;

write('Cac phan tu chan co trong mang la: ');

for i:=1 to n do

if a[i] mod 2=0 then

begin

write(a[i],' ');

t:=t+a[i];

end;

writeln;

write('Tong cac phan tu chan do la: ',t);

readln

end.

1 tháng 5 2023

Nếu làm i,n,t : integer; thì có đúng k ạ

2 tháng 5 2023

Program HOC24;

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

i,n: byte;

t: longint;

begin

write('Nhap N: '); readln(n);

for i:=1 to n do

begin

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

end;

write('Cac phan tu chan trong mang la: ');

for i:=1 to n do

if a[i] mod 2=0 then

begin

write(a[i],' ');

t:=t+a[i];

end;

writeln;

write('Tong cac phan tu chan trong day la: ',t);

readln

end.

10 tháng 3 2021

Bài 1: 

#include <bits/stdc++.h>

using namespace std;

long long a[50],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;

cout<<t;

return 0;

}

Bài 2: 

#include <bits/stdc++.h>

using namespace std;

long long a[50],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;

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

return 0;

}

18 tháng 12 2021

a: #include <bits/stdc++.h>

using namespace std;

unsigned long long int n,i,t1,t2,x;

int main()

{

cin>>n;

t1=0;

t2=0;

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

{

cin>>x;

if (x%2==0) t1=t1+x;

else t2=t2+x;

}

cout<<t1<<endl;

cout<<t2;

return 0;

}

14 tháng 3 2023

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

i,s:integer;

Begin

For i:=1 to 100 do

Begin

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

If a[i] mod 2 <> 0 then s:=s+a[i];

End;

Write('Tong la ',s);

Readln;

End.

15 tháng 3 2023

em cảm ơn ạ <3

uses crt;

var b:array[1..25]of integer;

i,n:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

write('B[',i,']='); readln(b[i]);

end;

readln;

end.

1 tháng 4 2022

Để mình giải cho

#include <bits/stdc++.h>

using namespace std;

long long a[50],i,n;

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<<a[i]<<" ";

return 0;

}

27 tháng 4 2023

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

i,b:integer;

s:real;

begin

write('Nhap so luong phan tu ');readln(b);

for i:=1 to b do

begin

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

s:=s+a[i];

end;

write('Tong cac phan tu la ',s:10:2);

readln

end.