Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main(){
- float nf;
- int n;
- do{
- cin>>nf;
- }
- while(nf<=2 or nf!=int(nf));
- n = int(nf);
- for(int i=1 ; i<=n ; i++){
- int cont = 0;
- for(int j=1 ; j<=i ; j++){
- if(i%j==0){
- cont++;
- }
- }
- if(cont == 2)
- cout<<i<<" ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement