Members Zekarjah Posted May 12, 2020 Members Posted May 12, 2020 Salut, in codul de mai jos o sa va arat cum aflati daca un numar este prim: #include<iostream.h> int n, ok, d; void main() { cin>>n; d=2; ok=1; while(d<=n/2&&ok==1) if(n%d==0) ok=0; else d++; if(ok==1) cout<<„Prim”; else cout<<„Nu”; } 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now