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 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;
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;
}
Uses crt;
Var a:array[1..6] of integer;
I,s:integer;
Begin
Clrscr;
For i:=1 to 6 do
Begin
Write('a[',i,']='); readln(a[i]);
End;
S:=1;
For i:=1 to 6 do
If a[i] mod 3=0 then s:=s*a[i];
Writeln(s);
Readln;
End.
Làm như z có đg ko
Uses crt;
Var n,i: integer;
A: Array[1..1000] of integer;
Begin
clrscr;
Repeat
Write('Nhap n: '); Readln(n);
Until (n<103) and (n>0);
a)
For i:=1 to n do
begin
Write('Nhap phan tu A[',i,']= ');
Readln(A[i]);
end;
b)
Write('Cac phan tu chan co trong mang: ');
For i:=1 to n do
If A[i] mod 2=0 then write(A[i],' ');
writeln;
c)
Write('Cac phan tu le co trong mang: ');
For i:=1 to n do
If A[i] mod 2=1 then write(A[i],' ');
Readln
End.
Uses crt;
var i,n: longint;
a: array[1..103] of longint;
begin clrscr;
readln(n);
for i:=1 to n do read(a[i]); readln;
for i:=1 to n do if(a[i] mod 2=0) then write(a[i],' ');
for i:=1 to n do if(a[i] mod 2<>0) then write(a[i],' ');
readln;
end.
uses crt;
var a: array[1..10000] of longint;
i,n:integer;
begin clrscr;
write('Nhap n: ');readln(n);
for i:=1 to n do read(a[i]); writeln('Cac phan tu chia het cho 3 va 5 la: ');
for i:=1 to n do
if (a[i] mod 3 = 0) and (a[i] mod 5=0) then writeln(a[i],' - vi tri thu ',i);
readln
end.
#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;
}
#include <bits/stdc++.h>
using namespace std;
long long a[1000],i,n,t;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++) cout<<a[i]<<" ";
cout<<endl;
t=0;
for (i=1; i<=n; i++) t+=a[i];
cout<<t;
return 0;
}
#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;
}
#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!!