Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n = 0, laik, dlaik, a, sk, nk;
- for(int i = 1; i < 99999; i++){
- laik = i;
- dlaik = i;
- //cout << n << endl;
- sk = 0; nk =0;
- while (dlaik > 0){
- dlaik = dlaik / 10;
- sk++;
- }
- dlaik = i;
- for(int i = 0; i < sk; i++){
- a = dlaik % 10;
- dlaik = dlaik / 10;
- if(a!= 0 and laik % a == 0) nk++;
- }
- if(sk == nk){
- n++;
- cout << i << endl;
- }
- if(n == 40) break;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement