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.
Bài 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
if a[i] mod 2<>0 then write(a[i]:4);
readln;
end.
Bài 2:
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
if a[i] mod 2=0 then write(a[i]:4);
readln;
end.
Uses crt;
var max,min,n,i,m,n: longint;
a: array[1..100] of longint
begin clrscr;
for i:=1 to n do begin
if(a[i] mod 2=0) then m:=m+a[i];
if(a[i] mod 2<>0) then n:=n+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('Tong cac phan tu chan: ',m);
Writeln('Tong cac phan tu le: ',n);
Writeln('Phan tu co gia tri lon nhat: ',max);
Writeln('Phan tu co gia tri nho nhat: ',min);
readln;
end.
Uses crt;
var max,min,n,i,m,n: longint;
a: array[1..100] of longint
begin clrscr;
for i:=1 to n do begin
if(a[i] mod 2=0) then m:=m+a[i];
if(a[i] mod 2<>0) then n:=n+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('Tong cac phan tu chan: ',m);
Writeln('Tong cac phan tu le: ',n);
Writeln('Phan tu co gia tri lon nhat: ',max);
Writeln('Phan tu co gia tri nho nhat: ',min);
readln;
end.
var a:array[1..1000] of integer;
i,n,d:integer;
s:longint;
tbc:real;
begin
write('n = ');readln(n);
For i:=1 to n do
begin
write('Nhap so thu ',i,' = ');readln(a[i]);
s:=s+a[i];
if a[i] mod 2 = 0 then d:=d+1;
end;
tbc:=s/n;
writel('Co ',d,' so chan');
write('Trung binh cong cua day so la ',tbc:10:2);
readln
end.
#include <bits/stdc++.h>
using namespace std;
long long x,n,i,dem;
int main()
{
cin>>n;
dem=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x%2==0) dem++;
}
cout<<dem;
return 0;
}
uses crt;
var a: array[1..100] of integer;
i,n,s,s1,s2,s3: integer;
begin
clrscr;
writeln(' nhap so phan tu cua day'); readln(n);
for i:=1 to n do
begin
writeln('a[',i,']'); readln(a[i]);
end;
write('day vua nhap la:');
s:=0;
for i:=1 to n do
begin
write(a[i],' ');
s:=s+a[i];
if a[i] mod 2=0 then s1:=s1+a[i];
if a[i] mod 2<>0 then s2:=s2+a[i];
if a[i] mod 3=0 then s3:=s3+a[i];
end;
writeln;
writeln('tong bang:',s);
writeln('tong chan:',s1);
writeln('tong le:',s2);
writeln('tong chia het cho 3:',s3);
readln
end.
program dem;
var
n, i, chan, le: integer;
a: array[1..1000] of integer;
begin
write('Nhap so phan tu cua day: ');
readln(n);
for i := 1 to n do
begin
write('Nhap phan tu thu ', i, ': ');
readln(a[i]);
end;
chan := 0;
le := 0;
for i := 1 to n do
begin
if (a[i] mod 2 = 0) then
chan := chan + 1
else
le := le + 1;
end;
writeln('So phan tu chan trong day la: ', chan);
writeln('So phan tu le trong day la: ', le);
end.