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;
long long a[1000],n,i;
int main()
{
freopen("so.inp","r",stdin);
freopen("so.out","w",stdout);
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++)
if (a[i]%2==0) cout<<a[i]<<" ";
return 0;
}
uses crt;
var st:string;
d,i,n:integer;
begin
clrscr;
readln(n);
str(n,st);
d:=length(st);
for i:=d downto 1 do
write(st[i]);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long n,i,j,dem;
bool kt;
int main()
{
freopen("dnto.inp","r",stdin);
freopen("dnto.out","w",stdout);
cin>>n;
for (i=2; i<=n; i++)
{
kt=true;
for (j=2; j*j<=i; j++)
if (i%j==0) kt=false;
if (kt==true) dem++;
}
cout<<dem;
return 0;
}
uses crt; var a,b:array[1..100000]of integer; i,n,kt,j,dem,x,y,kt1:integer; st,st1:string; 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]>1 then begin kt:=0; for j:=2 to a[i]-1 do if a[i] mod j=0 then begin kt:=1; break; end; if kt=0 then begin inc(dem); b[dem]:=a[i]; end; end; for i:=1 to dem do begin str(a[i],st); st1:=''; for j:=length(st) downto 1 do st1:=st1+st[j]; val(st1,x,y); kt1:=0; for j:=2 to x-1 do if x mod j=0 then begin kt1:=1; break; end; if kt1=0 then write(a[i]:4); end; readln; end.
uses crt; var a,b:array[1..100000]of integer; i,n,kt,j,dem,x,y,kt1:integer; st,st1:string; 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]>1 then begin kt:=0; for j:=2 to a[i]-1 do if a[i] mod j=0 then begin kt:=1; break; end; if kt=0 then begin inc(dem); b[dem]:=a[i]; end; end; for i:=1 to dem do begin str(a[i],st); st1:=''; for j:=length(st) downto 1 do st1:=st1+st[j]; val(st1,x,y); kt1:=0; for j:=2 to x-1 do if x mod j=0 then begin kt1:=1; break; end; if kt1=0 then write(a[i]:4); end; readln; end.
Var i,k,n,bk,tong: integer;
a: array[1..1000] of integer;
Begin
write('Nhap K: '); readln(k);
write('Nhap N: '); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
{câu a}
For i:=1 to n do
if a[i]=k then bk:=bk+1;
writeln('Co so phan tu bang k la:',k);
{câu b}
For i:=1 to n do
if a[i]=k then
begin
write(i,' ');
tong:=tong+a[i];
end;
write('. Tong la:',tong);
readln
end.
uses crt;
var k,n,tong,d,i:longint;a:array[1..1000]of longint;
begin
clrscr;
write('n=');readln(n);
write('k=');readln(k);
for i:=1 to n do
begin
write('a[',i,']=');readln(a[i]);
end;
d:=0;
for i:=1 to n do if(a[i]=k)then inc(d);
writeln('so phan tu bang voi:',k,' la:',d);
write('cac so co vi tri bang voi:',k,' la:');
tong:=0;
for i:=1 to n do if(a[i]=k)then
begin
write(i,' ');
tong:=tong+a[i];
end;
write('tong cua cac so bang voi:',k,' la:',tong);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
double a,b;
int main()
{
freopen("ab.inp","r",stdin);
freopen("ab.out","w",stdout);
cin>>a>>b;
cout<<fixed<<setprecision(1)<<a+b<<endl;
cout<<fixed<<setprecision(1)<<a-b;
return 0;
}
uses crt;
var a:array[1..1000]of integer;
i,n,k,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
write('Nhap k='); readln(k);
t:=0;
for i:=1 to n do
if a[i] mod k=0 then t:=t+a[i];
writeln('Tong cac so la boi cua ',k,' la: ',t);
readln;
end.
uses crt;
var a:array[1..100]of integer;
n,i,k,dem,dem1:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
write('Nhap k='); readln(k);
dem:=0;
dem1:=0;
for i:=1 to n do
begin
if a[i] mod 2=0 then inc(dem);
if a[i] mod k=0 then inc(dem1);
end;
writeln('So phan tu chan la: ',dem);
writeln('So phan tu chia het cho ',k,' la: ',dem1);
readln;
end.
Viết bằng pascal dc k
Được ạ. Anh viết nhanh hộ em với. Em cảm ơn nhiều ạ.