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 i,n,n,d: integer;
t: longint;
A: array[1..32000] of integer;
begin
clrscr;
readln(n);
for i:=1 to n do
readln(a[i]);
for i:=1 to n do
if a[i] >0 then
begin
d:=d+1;
t:=t+a[i];
end;
writeln('Tong la:',t);
write('Co tat ca so so duong la:',d);
readln;
end.
Bài 5:
Var a:array:[1..1000] of integer;
i,n,max:integer;
sc, sl:longint;
Begin
Write('n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap so thu ',i,' = ');rreadlna[i]);
If a[i] mod 2 = 0 then sc:=sc+b[i];
If a[i] mod 2 <> 0 then sl:=sl+a[i];
End;
max:=a[1];
For i:=2 to n do
If a[i] > max then max:=a[i];
Writeln('Tong cac so chan la ',sc);
Writeln('Tong cac so le la ',sl);
write('So lon nhat la ',max);
Readln
End.
#include <bits/stdc++.h>
using namespace std;
long long a[10000],i,n,t1,t2;
int main()
{
cin>>n;
t1=0;
t2=0;
for (i=1; i<=n; i++)
{
cin>>a[i];
if (a[i]%2==0) t1+=a[i];
else t2+=a[i];
}
cout<<t1<<endl;
cout<<t2;
return 0;
}
program im_14424;
uses crt;
var A: array[1..9999999] of interger;
S,P : integer;
i,n: byte;
begin
clrscr;
S:=0;
P:=0;
for i:=1 to n do
begin
write('Nhap vao phan tu thu: ',i,);
readln(A[i]);
S:=S+A[i]
P:=P*A[i]
end;
writeln(S);
write(P);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long a[1000],n,i,dem1,dem2;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++) cout<<a[i]<<" ";
cout<<endl;
dem1=0;
dem2=0;
for (i=1; i<=n; i++)
{
if (a[i]%2==0) dem1++;
else dem2++;
}
cout<<dem1<<" "<<dem2;
return 0;
}
program TongChanLe;
var
n,i, chans, les: integer; a: array[1..100] of integer;
begin
chans := 0;
les := 0;
write('Nhap n: ');
readln(n);
for i:=1 to n do
begin
write('Nhap so thu ', i, ': ');
readln(a[i]);
if a[i] mod 2 = 0 then
chans := chans + a[i]
else
les := les + a[i];
end;
writeln('Tong cac so chan la: ', chans);
writeln('Tong cac so le la: ', les);
readln;
end.
GIÚP MÌNH VỚI MÌNH ĐANG CẦN GẤP :(((
uses crt;
var a:array[1..100]of integer;
n,i,dem:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
for i:=1 to n do
if a[i] mod 2<>0 then
begin
write(a[i]:4);
inc(dem);
end;
writeln;
writeln('So so le la: ',dem);
readln;
end.