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.
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
uses crt;
var a:array[1..10]of longint;
n,i,t,dem,dem1,dem2,t1: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 t:=t+a[i];
writeln(t);
t1:=0;
dem1:=0;
dem2:=0;
for i:=1 to n do
begin
if a[i]>0 then dem1:=dem+1;
if a[i] mod 2=0 then
begin
dem2:=dem2+1;
t1:=t1+a[i];
end;
end;
writeln(dem1);
writeln(t1/dem2:4:2);
readln;
end.
uses crt;
var a:array[1..10]of longint;
n,i,t,dem,dem1,dem2,t1: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 t:=t+a[i];
writeln(t);
t1:=0;
dem1:=0;
dem2:=0;
for i:=1 to n do
begin
if a[i]>0 then dem1:=dem+1;
if a[i] mod 2=0 then
begin
dem2:=dem2+1;
t1:=t1+a[i];
end;
end;
writeln(dem1);
writeln(t1/dem2:4:2);
readln;
end.
tham khảo'
uses crt;
var a:array[1..100]of integer;
i,n,t,dem:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
dem:=0;
for i:=1 to n do
if a[i] mod 2=0 then
begin
t:=t+a[i];
inc(dem);
end;
writeln('Tong cac so chan la: ',t);
writeln('So luong so chan la: ',dem);
readln;
end.
Var a:array[1..100] of integer;
i,n,dem,vt,s sc,sl,min:integer;
tbc:real;
Begin
Write('Nhap so luong phan tu n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap phan tu thu ',i,' = ');readln(a[i]);
End;
For i:=1 to n do s:=s+a[i];
tbc:=s/n;
Writeln('Gia tri trung binh cua mang la ',tbc:10:2);
Write('Cac phan tu lon hon gia tri trung binh la ');
For i:=1 to n do
If a[i]>tbc then write(a[i],' ');
For i:=1 to n do
Begin
If a[i] mod 2 = 0 then sc:=sc+a[i]
Else sl:=sl+a[i];
End;
Writeln('Tong cac phan tu chan la ',sc);
Writeln('Tong cac phan tu le la ',sl);
min:=a[1];
For i:=2 to n do
Begin
If a[i] < min then min:=a[i];
vt:=i;
End;
Writeln('Phan tu nho nhat la ',min,' tai vi tri ',vt);
For i:=1 to n do
If a[i] mod 5 = 0 then dem:=dem+1;
Write('So cac phan tu chia het cho 5 la ',dem);
Readln;
End.
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;
}
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);