Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- //1111 до 9999
- for (int thousands = 1; thousands <= 9; thousands++) //хилядни
- {
- for (int hundreds = 1; hundreds <= 9; hundreds++) //стотици
- {
- for (int tens = 1; tens <= 9; tens++) //десетици
- {
- for (int units = 1; units <= 9; units++) //единици
- {
- //четирицифрено число: {thousands}{hundreds}{tens}{units}
- //проверка дали е специално
- if (n % thousands == 0 && n % hundreds == 0 && n % tens == 0 && n % units == 0)
- {
- cout << thousands << hundreds << tens << units << " ";
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement