nhập mã gồm n số nguyên từ bàn phím , xuất mãng vừa nhập , tính tổng các ptu của mãng , tính tổng các ptu là số âm,dương có trong mãng
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.


uses crt;
var a:array[1..100]of integer;
i,n,t:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
for i:=1 to n do write(a[i]:4);
writeln;
t:=0;
for i:=1 to n do
if a[i] mod 2=0 then t:=t+a[i];
writeln(t);
readln;
end.

refer
uses crt;
var a:array[1..100]of integer;
n,i,max,min: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];
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('Vi tri cua so lon nhat la: ');
for i:=1 to n do
if max=a[i] then write(i:4);
writeln;
writeln('Vi tri cua so nho nhat la: ');
for i:=1 to n do
if min=a[i] then write(i:4);
readln;

#include <bits/stdc++.h>
using namespace std;
long long a[10],i,t,dem;
int main()
{
for (i=1; i<=10; i++) cin>>a[i];
t=0;
dem=0;
for (i=1; i<=10; i++)
{
if (a[i]%2==0) t=t+a[i];
else dem++;
}
for (i=1; i<=10; i++) cout<<a[i]<<" ";
cout<<endl;
cout<<t<<endl;
cout<<dem;
return 0;
}

#include <bits/stdc++.h>
using namespace std;
long long a[10],i,n,t1,dem1,s;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++) cout<<a[i]<<" ";
cout<<endl;
t1=0;
dem1=0;
s=1;
for (i=1; i<=n; i++)
{
if (a[i]%2==0) t1+=a[i];
else dem1+=1;
if ((a[i]%2==0) or (a[i]%3==0)) s=s*a[i];
}
cout<<t1<<endl;
cout<<dem1<<endl;
cout<<s;
return 0;
}

program TimSoLonNhatVaDemSoAm;
var
N, i, max, dem: integer;
a: array[1..100] of integer;
begin
writeln('Nhap so ptu cua day: ');
readln(N);
for i := 1 to N do
begin
write('Nhap ptu thu ', i, ': ');
readln(a[i]);
end;
max := a[1];
for i := 2 to N do
begin
if a[i] > max then
max := a[i];
end;
writeln('So lon nhat trong day la: ', max);
dem := 0;
for i := 1 to N do
begin
if a[i] < 0 then
dem := dem + 1;
end;
writeln('So ptu am trong day la: ', dem);
end.

Viết câu lệnh thực hiện yêu cầu sau:
4. Với dữ liệu câu 2, yêu cầu tính và in ra màn hình:
4a. Tổng các số chẵn
4b. Đếm các số lẽ
4c. Tích các số chia hết cho 2 hoặc 3
#include <bits/stdc++.h>
using namespace std;
long long a[10],i,n,t1,dem1,s;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++) cout<<a[i]<<" ";
cout<<endl;
t1=0;
dem1=0;
s=1;
for (i=1; i<=n; i++)
{
if (a[i]%2==0) t1+=a[i];
else dem1+=1;
if ((a[i]%2==0) or (a[i]%3==0)) s=s*a[i];
}
cout<<t1<<endl;
cout<<dem1<<endl;
cout<<s;
return 0;
}

uses crt;
var g:array[1..5]of integer;
i,vtc,vtl:integer;
begin
clrscr;
for i:=1 to 5 do
begin
write('G[',i,']='); readln(g[i]);
end;
vtc:=0;
vtl:=0;
for i:=1 to 5 do
begin
if g[i] mod 2=0 then
begin
if vtc<i then vtc:=i;
end
else begin
if vtl<i then vtl:=i;
end;
end;
writeln('Vi tri phan tu le cuoi cung la: ',vtl);
writeln('Vi tri phan tu chan cuoi cung la: ',vtc);
readln;
end.

Mình chỉ viết chương trình chính thôi, còn chương trình con bạn tự viết nhé
uses crt;
var a:array[1..100]of integer;
i,n,t,t1,t2:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
edn;
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln(t);
readln;
end.

uses crt;
var a:array[1..100]of integer;
i,n,t,kt,j:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
writeln('Cac so vua nhap la: ');
for i:=1 to n do
write(a[i]:4);
writeln;
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln('Tong cua day so la: ',t);
kt:=0;
for j:=2 to trunc(sqrt(t)) do
if t mod j=0 then
begin
kt:=1;
break;
end;
if kt=0 then writeln(t,' la so nguyen to')
else writeln(t,' khong la so nguyen to');
readln;
end.
Cậu ơi sai khúc write('A[',i,']='); readln(a[i]); rồi nó cứ bị sao sao á
#include <bits/stdc++.h>
using namespace std;
long long a[1000],n,i,t1,t2,t3;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++) cout<<a[i]<<" ";
cout<<endl;
t1=0;
t2=0;
t3=0;
for (i=1; i<=n; i++)
{
t1+=a[i];
if (a[i]<0) t2+=a[i];
if (a[i]>0) t3+=a[i];
}
cout<<t1<<endl;
cout<<t2<<endl;
cout<<t3;
return 0;
}