Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Example program
- //Tati nameri si nov kompiler :D
- #include <iostream>
- int simpleNumbers(int n){
- int numberOfDevisions=0;
- for(int i=1;i<=n;i++){
- if(n%i==0) numberOfDevisions++;
- }
- if(numberOfDevisions>2) return 1;
- return 0;
- }
- int main()
- {
- int number;
- std::cout<<"Enter the Range you want to search "; std::cin>>number;
- for(int i=2;i<=number;i++){
- if(simpleNumbers(i)!=1) std::cout<<i<<" ";
- }
- std::cin.get(); std::cin.get(); //this line replaces return 0
- }
Advertisement
Add Comment
Please, Sign In to add comment