Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- 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++)
- {
- bool check1 = n % thousands == 0;
- bool check2 = n % hundreds == 0;
- bool check3 = n % tens == 0;
- bool check4 = n % units == 0;
- if (check1 && check2 && check3 && check4) {
- cout << thousands << hundreds << tens << units << " ";
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment