Pascal:
uses crt;
var n:longint;
function isPrimeNumber(a:longint):boolean;
var i:longint;
begin
if a<2 then exit(false);
for i:=2 to trunc(sqrt(a)) do
if a mod i=0 then exit(false);
exit(true);
end;
function isSpecialPrime(n:longint):boolean;
begin
while n<>0 do
begin
if isPrimeNumber(n)=false then exit(false);
n:=n div 10;
end;
exit(true);
end;
begin
clrscr;
readln(n);
if isSpecialPrime(n) then write('true') else write('false');
readln
end.
C++:
#include<bits/stdc++.h>
using namespace std;
bool isPrimeNumber(int a) {
if (a<2)
return false;
for (int i=2;i<=sqrt(a);i++) {
if (a%i==0)
return false;
}
return true;
}
bool isSpecialPrime(int n) {
while (n!=0) {
if (isPrimeNumber(n)==false) {
return false;
}
n/=10;
}
return true;
}
int main() {
int n;
cin>>n;
if (isSpecialPrime(n)) {
cout<<"true";
} else {
cout<<"false";
}
}
program sieu_nguyen_to;
var n:integer;
{---Ham-nguyen-to---}
function ktnt(k:integer):boolean;
var e:integer;
begin
ktnt:=false;
if k<2 then exit;
for e:=2 to trunc(sqrt(k)) do
if k mod e=0 then exit;
ktnt:=true;
end;
{---Ham-sieu-nguyen-to---}
function ktsnt(x:integer):boolean;
begin
ktsnt:=false;
while x>0 do
begin
if ktnt(x)=false then exit;
x:=x div 10;
end;
ktsnt:=true;
end;
{---Chuong-trinh-chinh---}
BEGIN
clrscr;
write('Nhap so can kiem tra: '); readln(n);
if ktsnt(n) then write('Yes') else write('No');
readln;
end.
Tin học, tiếng Anh: informatics, tiếng Pháp: informatique, là một ngành khoa học chuyên nghiên cứu quá trình tự động hóa việc tổ chức, lưu trữ, xử lý và truyền dẫn thông tin của một hệ thống máy tính cụ thể hoặc trừu tượng (ảo). Với cách hiểu hiện nay, tin học bao hàm tất cả các nghiên cứu và kỹ thuật có liên quan đến việc mô phỏng, biến đổi và tái tạo thông tin.
Nguồn : Wikipedia - Bách khoa toàn thưLớp 11 - Năm thứ hai ở cấp trung học phổ thông, gần đến năm cuối cấp nên học tập là nhiệm vụ quan trọng nhất. Nghe nhiều đến định hướng sau này rồi học đại học. Ôi nhiều lúc thật là sợ, hoang mang nhưng các em hãy tự tin và tìm dần điều mà mình muốn là trong tương lai nhé!
Nguồn : ADMIN :))Copyright © 2021 HOCTAP247