Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // SpecialNumbers.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- int digit4 = 0;
- int digit3 = 0;
- int digit2 = 0;
- int digit1 = 0;
- for (int i = 1; i <= 9; i++)
- {
- for (int k = 1; k <= 9; k++)
- {
- for (int j = 1; j <= 9; j++)
- {
- for (int g = 1; g <= 9; g++)
- {
- int special_number;
- digit4 = i / 1000;
- digit3 = k / 100 % 10;
- digit2 = j / 10 % 10;
- digit1 = g % 10;
- if (special_number = n % digit1 == 0 && n % digit2 == 0
- && n % digit3 == 0 && n % digit4 == 0)
- {
- cout << digit1 << digit2 << digit3 << digit4 << " ";
- }
- }
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement