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..500]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.
Program HOC24;
var i,n: integer;
a: array[1..200] of integer;
t: longint;
begin
write('Nhap N: '); readln(n);
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do if a[i] mod 2=0 then t:=t+a[i];
write('Tong cac so chan trong mang la: ',t);
readln
end.
uses crt;
var a:array[1..90] of longint;
n,i:integer;
begin
clrscr;
write('Nhap so luong phan tu (n<=90): '); readln(n);
for i:=1 to n do
begin
write('Nhap phan tu thu ',i,': '); readln(a[i]);
end;
write('Cac so chan: ');
for i:=1 to n do if a[i] mod 2=0 then write(a[i],' ');
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n,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 inc(dem);
writeln(dem);
readln;
end.
uses crt;
var a,i,t:integer;
N: array[1..300] of integer;
begin
clrscr;
write('nhap so a: '); readln(a);
t:=0;
for i:=1 to a do
begin
writeln('N[',i,']= '); readln(N[i]);
if N[i] mod 2<>0 then t:=t+N[i];
end;
writeln('tong cac so le trong mang la: ',t);
readln;
end.
uses crt;
var a:array[1..300]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;
t:=0;
for i:=1 to n do
if a[i] mod 2<>0 then t:=t+a[i];
writeln(t);
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;
}
#include <bits/stdc++.h>
using namespace std;
long long b[20],i,n;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>b[i];
for (i=1; i<=n; i++)
{
if ((b[i]%2!=0) or (i%2==0)) cout<<b[i]<<" ";
}
return 0;
}
Bài 1:
#include <bits/stdc++.h>
using namespace std;
long long x,n,i,t;
int main()
{
cin>>n;
t=0;
for (i=1; i<=n; i++)
{
cin>>x;
if ((x<0) and (x%2!=0)) t=t+x;
}
cout<<t;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long n,i,a[10000];
int main()
{
cin>>n;
for (i=1; i<=n; i++)
cin>>a[i];
for (i=1; i<=n; i++) cout<<a[i]<<" ";
return 0;
}
uses crt;
var a:array[1..500]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.