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,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.
uses crt;
var i,n,m,k,d:integer;
{---------------chuong-trinh-con-tim-ucln--------------------}
function ucln(x,y:integer):integer;
var t:integer;
begin
while y<>0 do
begin
t:=x mod y;
x:=y;
y:=t;
end;
ucln:=x;
end;
{------------chuong-trinh-con-kiem-tra-so-nguyen-to-------------------}
function nt(b:longint):boolean;
var j:longint;
begin
nt:=true;
if (b=2) or (b=3) then exit;
nt:=false;
if (b=1) or (b mod 2=0) or (b mod 3=0) then exit;
j:=5;
while j<=trunc(sqrt(b)) do
begin
if (b mod j=0) or (b mod (j+2)=0) then exit;
j:=j+6;
end;
nt:=true;
end;
{---------------chuong-trinh-chinh---------------------}
begin
clrscr;
write('Nhap N: '); readln(N);
write('Nhap M: '); readln(M);
d:=0;
k:=ucln(N,M);
for i:=1 to k do
if nt(i) then d:=d+1;
if d>0 then writeln('2 so nay tuong duong voi nhau')
else writeln('2 so nay khong tuong duong voi nhau');
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long n,i;
bool kt;
int main()
{
cin>>n;
kt=true;
for (i=2; i*i<=n; i++)
if (n%i==0) kt=false;
if ((kt==true) and (n>1)) cout<<"YES";
else cout<<"NO";
return 0;
}
a)
uses crt;
VAR
n, d, i: integer;
BEGIN
clrscr;
Writeln ('Nhap vao n='); readln (n);
d : = 1;
For i: = 1 to n do
d: = d*i;
Writeln ('d=',d);
Readln;
END.
c)
uses crt;
VAR
n, i, demuoc: integer;
BEGIN
clrscr;
Writeln ('Nhap vao n='); readln (n);
demuoc: = 0;
For i: = 1 to n do
If n mod i = 0 then
demuoc : = demuoc + 1;
If demuoc = 2 then
Writeln ('n la so nguyen to')
ELSE
Writeln ('n khong phai la so nguyen to');
Readln ;
END.
Còn phần b bạn tự nghĩ nha!
Chúc bạn học tốt!
function NT(n: integer): boolean;
var i: integer;
begin
NT:=true;
for i:=2 to n-1 do
if n mod i = 0 then NT:=false;
end;
var i: integer;
begin
write('Cac so sieu nguyen to cap do 2: ');
for i:=100 to 10000 do
if (NT(i) and NT(i div 10) and NT(i div 100)) then write(i:6);
readln
end.
phần xử lý à?