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 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.
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.
#include <fstream>
using namespace std;
int gia_tri_cuoi(int x)
{
if (x < 10) return x;
int tong = 0;
while (x > 0)
{
tong += x % 10;
x /= 10;
}
return gia_tri_cuoi(tong);
}
int main()
{
ifstream fin("LUCKY.INP");
ofstream fout("LUCKY.OUT");
int a[105];
int N;
fin >> N;
for (int i = 0; i<N; ++i) fin >> a[i];
int LUCKY[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
for (int i = 0; i<N; ++i) ++LUCKY[gia_tri_cuoi(a[i])];
int max = -1;
int ketqua = 0;
for (int i = 0; i<10; ++i)
{
if (LUCKY[i] > max)
{
ketqua = i;
max = LUCKY[i];
}
}
fout << ketqua << endl;
return 0;
}
program hotrotinhoc;
const fi='LUCKY.INP';
fo='LUCKY.OUT';
var n,k,a,i,max,d: byte;
dem,m,m1: array[0..105] of integer;
f: text;
function tong(x: byte): integer;
var t,t1: integer;
begin
t:=0; t1:=0;
while x<>0 do
begin
t:=t+(x mod 10);
x:=x div 10;
end;
while t<>0 do
begin
t1:=t1+(t mod 10);
t:=t div 10;
end;
tong:=t1;
end;
procedure ip;
begin
assign(f,fi);
reset(f);
readln(f,n);
for i:=1 to n do
read(f,m[i]);
close(f);
end;
procedure out;
begin
assign(f,fo);
rewrite(f);
for i:=1 to n do
begin
m1[i]:=tong(m[i]);
inc(dem[m1[i]]);
end;
max:=0;
for i:=1 to n do
if dem[i]<>0 then
if max<=dem[i] then max:=dem[i];
write(f,max);
close(f);
end;
begin
ip;
out;
end.
#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;
}
#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;
}
#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;
}
Viết bằng pascal dc k
Được ạ. Anh viết nhanh hộ em với. Em cảm ơn nhiều ạ.