Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- unsigned long n,k,nr=1,d,nrdiv;
- cout<<"n=";cin>>n;
- cout<<"k=";cin>>k;
- while (nr<=n)
- {
- nrdiv=2;
- d=nrdiv;
- while (d<=nr/2)
- {
- if (nr%d==0)
- nrdiv++;
- d++;
- }
- if (nrdiv==k)
- cout<<nr<<" ";
- nr++;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement