Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int n,v[100],i,p,d,s;
  4. int prim(n)
  5. {for(i=1;i<n;i++)
  6. cin>>v[i]; cout<<"v["<<i<<"]=";}
  7. {for(d=2;d<=v[i]/2;d++)
  8. if(v[i]%d==0) cout<<"Nu este prim";
  9. else return p=p+1;}
  10. for(s=2;s<=p/2;s++)
  11. if(p%s==0) cout<<"p nu este prim";
  12. else cout<<"p este prim";
  13.  
  14.  
  15. int main()
  16. {int n;
  17. cin>>n; cout<<"n=";
  18. cout<<prim(n);
  19.  
  20. return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement