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;
bool kt;
int n,i;
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;
}
program tim_uoc;
uses crt;
var n,i,j:longint;
begin
clrscr;
write('nhap so n:');readln(n);
write('cac uoc cua n la:');
for i:=1 to n do
if n mod i=0 then write(i:3);
writeln;
j:=0;
for i:=1 to n do
if n mod i=0 then j:=j+1;
if j=2 then writeln(n,' la so nguyen to')
else writeln(n,' khong phai la so nguyen to');
readln;
end.
var x, i : integer;
begin
writeln('nhap so nguyen x : ')
read(x);
if ( x < 2) then writeln(' x khong phai so nguyen to');
else if ( x > 2) then
begin
for i := 2 to ( x - 1) do
begin
if ( x mod i = 0) then writeln(' x khong la so nguyen to');
end;
end;
else
writeln(' x la so nguyen to');
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long n;
//chuongtrinhcon
bool ktnt(long long n)
{
if (n<2) return(false);
else
for (int i=2; i*i<=n;i++)
if (n%i==0) return (false);
return(true);
}
//chuongtrinhchinh
int main()
{
//freopen("KTSNT.INP","r",stdin);
//freopen("KTSNT.OUT","w",stdout);
cin>>n;
if (ktnt(n)==true) cout<<"1";
else cout<<"0";
return 0;
}
#include <bits/stdc++.h>
using namespace std;
bool ktsnt(long long n)
{
long long i;
if(n<2) return false;
else
{
for(i=2;i<=sqrt(n);i++)
if(n%i==0)
return false;
return true;
}
}
long long cnt;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin>>cnt;
if(ktsnt(cnt)==true)
cout<<"YES";
else
cout<<"NO";
return 0;
}
var i,n,dem:integer;
begin
write('Nhap n = ');readln(n);
for i:=1 to n do
begin
if n mod i = 0 then dem:=dem+1;
end;
if dem = 2 then write(n,' la so nguyen to')
else write(n,' khong la so nguyen to');
readln;
end.
c:
#include <bits/stdc++.h>
using namespace std;
long long a[1000],n,i;
int main()
{
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;
}
d:
#include <bits/stdc++.h>
using namespace std;
long long a[1000],n,i,nn;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
nn=a[1];
for (i=1; i<=n; i++) nn=min(nn,a[i]);
cout<<nn;
return 0;
}
Bài 1:
uses crt;
var n,i,kt:integer;
begin
clrscr;
write('Nhap n='); readln(n);
kt:=0;
for i:=2 to n-1 do
if n mod i=0 then kt:=1;
if (kt=0) and (n>1) then writeln(n,' la so nguyen to')
else writeln(n,' khong la so nguyen to');
readln;
end.
Bài 2:
uses crt;
var n,i:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
if n mod i=0 then write(i:4);
readln;
end.
2:
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,i,kt=0;
cin>>n;
for (int i=2; i*i<=n; i++)
if (n%i==0) kt=1;
if (kt==0) cout<<"YES";
else cout<<"NO";
}
#include <bits/stdc++.h>
using namespace std;
long long n;
//chuongtrinhcon
bool ktnt(long long n)
{
if (n<2) return(false);
else
for (int i=2; i*i<=n;i++)
if (n%i==0) return (false);
return(true);
}
//chuongtrinhchinh
int main()
{
//freopen("KTSNT.INP","r",stdin);
//freopen("KTSNT.OUT","w",stdout);
cin>>n;
if (ktnt(n)==true) cout<<"1";
else cout<<"0";
return 0;
}
uses crt;
var a,x:longint;
{------------------ham-kiem-tra-so-nguyen-to---------------}
function ktnt(x:longint):boolean;
var kt:boolean;
i:longint;
begin
kt:=true;
for i:=2 to trunc(sqrt(x)) do
if x mod i=0 then
begin
kt:=false;
break;
end;
if kt=true then ktnt:=true
else ktnt:=false;
end;
{---------------chuong-trinh-chinh-------------------}
begin
clrscr;
repeat
write('Nhap a='); readln(a);
until a>10;
if ktnt(a)=true then
begin
x:=a;
repeat
a:=a div 10;
if ktnt(a)=true then a:=a div 10;
until a<10;
if (ktnt(a)=true) and (a>1) then writeln(x,' la so sieu nguyen to')
else writeln(x,' khong la so sieu nguyen to');
end
else writeln(a,' khong la so sieu nguyen to');
readln;
end.
bn ơi cấu hỏi hơi bị khó hiểu xíu