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.
#include <bits/stdc++.h>
using namespace std;
int n,x,i,cnt,res;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>n>>cnt;
for(i=0;i<n;i++)
{
cin>>x;
if(x%cnt==0) res++;
}
cout<<"so luong phan tu chia het cho "<<cnt<<" la: "<<res;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
const int gh=1000;
int n,x,i,cnt,res,dem[gh];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>n>>cnt;
for(i=0;i<n;i++)
{
cin>>x;
if(x%cnt==0) { res++; dem[res]=x;}
}
cout<<"so luong phan tu chia het cho "<<cnt<<" la: "<<res;
cout<<"\n"<<"cac phan tu do la: "<<"\n";
for(i=1;i<=res;i++)
cout<<dem[i]<<" ";
return 0;
}
// đây mới đúng mik đọc lỗi đề nha bạn!!
Program HOC24;
var i,d,n,x: integer;
a: array[1..100] of integer;
begin
write('Nhap so phan tu: '); readln(n);
for i:=1 to n do
begin
write('Nhap phan tu thu ',i,': '); readln(a[i]);
end;
write('Nhap x: '); readln(x);
d:=0;
for i:=1 to n do if a[i] mod x=0 then d:=d+1;
write(d);
readln
end.
#include <bits/stdc++.h>
using namespace std;
int n,x,i,rel=0,rec=0;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>n;
for(i=0;i<n;i++)
{
cin>>x;
if(x%2==0) rec+=x;
else rel+=x;
}
cout<<"tong chan cua cac phan tu chan la: "<<rec<<"\n";
cout<<"tong chan cua cac phan tu le la: "<<rel<<"\n";
return 0;
}
Var a:array[1..12] of integer;
i,n,max:integer;
Begin
For i:=1 to 12 do
Begin
Write('Nhap phan tu thu ',i,' = ');readln(a[i]);
End;
max:=a[1];
For i:=2 to 12 do
If a[i]>max then max:=a[i];
Write('So lon nhat la ',max);
Readln;
End.
Program HOC24;
var n,d,i: integer;
B: array[1..100] of integer;
t: longint;
begin
write('Nhap N: '); readln(n);
for i:=1 to n do
begin
write('B[',i,']='); readln(b[i]);
end;
d:=0; t:=0;
for i:=1 to n do
if b[i]>0 then
begin
d:=d+1;
t:=t+b[i];
end;
writeln('Tong cac so duong trong day so la: ',t);
write('Co ',d,' so duong trong day');
readln
end.
uses crt;
var b:array[1..100] of longint;
n,i,d,s:longint;
begin
clrscr;
write('n='); readln(n);
for i:=1 to n do
begin
write('a[',i,']: '); readln(b[i]);
if b[i]>0 then begin
inc(d);
inc(s,b[i]);
end;
end;
writeln('Tong cac so duong: ',s);
writeln('Co ',d,' so duong');
readln;
end.
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;
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>0) dem++;
}
cout<<dem;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a[1000],n,i,x,dem;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
cin>>x;
dem=0;
for (i=1; i<=n; i++)
if (a[i]%x==0)
{
cout<<a[i]<<" ";
dem++;
}
cout<<endl;
cout<<dem;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int n,x,i,cnt,res=0;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>n>>x;
for(i=0;i<n;i++)
{
cin>>cnt;
if(cnt==x) res++;
}
cout<<"so luong xuat hien so "<<x<<" la: "<<res;
return 0;
}