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.
Program bt_3;
Uses crt;
Var a: array[1..100] of integer;
Dem, Tong, n, i: integer;
Begin
Clrscr;
Writeln(‘nhap so phan tu, n=’);
Readln (n);
for i := 1 to n do
begin
writeln(‘nhap gia trij phan tu thu ’,i,’ =’);
readln(a[i]);
end;
Dem:=0;
Tong:=0;
For i:=1 to n do
If (a[i] mod 2 = 0) and (a[i] mod 3 = 0) then
begin
Dem:= Dem+1;
Tong:= Tong+a[i];
end;
writeln(‘Dem la:’,Dem);
Writeln(‘Tong la:’,Tong);
Readln
End.
Program bt_3;
Uses crt;
Var a: array[1..100] of integer;
Dem, Tong, n, i: integer;
Begin
Clrscr;
Writeln(‘nhap so phan tu, n=’);
Readln (n);
for i := 1 to n do
begin
writeln(‘nhap gia trij phan tu thu ’,i,’ =’);
readln(a[i]);
end;
Dem:=0;
Tong:=0;
For i:=1 to n do
If (a[i] mod 2 = 0) and (a[i] mod 5 = 0) then
begin
Dem:= Dem+1;
Tong:= Tong+a[i];
end;
writeln(‘Dem la:’,Dem);
Writeln(‘Tong la:’,Tong);
Readln
End.
Tham khảo
uses crt;
var n,i,ta,td,d1,d2:integer;
a:array[1..100]of integer;
begin
clrscr;
write('nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
td:=0;
d1:=0;
for i:=1 to n do
if a[i]>0 then
begin
td:=td+a[i];
inc(d1);
end;
writeln('Trung binh cong cac so duong la: ',td/d1:4:2);
d2:=0;
ta:=0;
for i:=1 to n do
if a[i]<0 then
begin
inc(d2);
ta:=ta+a[i];
end;
writeln('Trung binh cong cac so am la: ',ta/d2:4:2);
readln;
end.
Program bt_3;
Uses crt;
Var a: array[1..100] of integer;
Dem, Tong, n, i: integer;
Begin
Clrscr;
Writeln(‘nhap so phan tu, n=’);
Readln (n);
for i := 1 to n do
begin
writeln(‘nhap gia trij phan tu thu ’,i,’ =’);
readln(a[i]);
end;
Dem:=0;
Tong:=0;
For i:=1 to n do
If (a[i] mod 2 = 1) and (a[i] mod 3 = 0) then
begin
Dem:= Dem+1;
Tong:= Tong+a[i];
end;
writeln(‘Dem la:’,Dem);
Writeln(‘Tong la:’,Tong);
Readln
End.
Program bt_3;
Uses crt;
Var a: array[1..100] of integer;
Dem, Tong, n, i: integer;
Begin
Clrscr;
Writeln(‘nhap so phan tu, n=’);
Readln (n);
for i := 1 to n do
begin
writeln(‘nhap gia trij phan tu thu ’,i,’ =’);
readln(a[i]);
end;
Dem:=0;
Tong:=0;
For i:=1 to n do
If (a[i] mod 2 = 1) and (a[i] mod 5 = 0) then
begin
Dem:= Dem+1;
Tong:= Tong+a[i];
end;
writeln(‘Dem la:’,Dem);
Writeln(‘Tong la:’,Tong);
Readln
End.
#include <bits/stdc++.h>
using namespace std;
long long x,n,i,t,dem;
int main()
{
cin>>n;
dem=0;
t=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x%2==0 && x>10) t+=x;
if (x%2!=0 || x<100) dem++;
}
cout<<t<<" "<<dem;
return 0;
}
uses crt;
var a:array[1..100]of integer;
i,n,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
writeln('Cac phan tu chan la: ');
for i:=1 to n do
if a[i] mod 2=0 then write(a[i]:4);
writeln;
t:=0;
for i:=1 to n do
if a[i] mod 5=0 then t:=t+a[i];
writeln('Tong cac so la boi cua 5 la: ',t);
readln;
end.
var a:array[1..100] of integer;
i,n,S,d:byte;
begin
write(' n = '); readln(n);
for i:=1 to n do begin
write('A[',i,'] = ');
readln(A[i]);
end;
d:=0; S:=0;
for i:=1 to n do if A[i] mod 2 = 0 then begin
d:=d+1;
S:=S+A[i];
end;
write('Dãy có ',d,' phần tử là số chẵn và tổng của chúng là : S = ',S);
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;
}