Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- int d,n,prim=1; ///n - numar natural
- ///cout<<"n=";
- cin>>n;
- if(n<=1){
- prim=0;
- }
- for(d=2; d*d<=n; d++){
- if(n%d == 0)
- {
- prim=0;
- }
- }
- if(prim==1){
- cout<<"prim";
- }
- else{
- cout<<"nu este prim";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement