Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApplication1
- {
- class Program
- {
- static int N;
- static int i = 0;
- static int edinici;
- static int desetici;
- static int stotici;
- static int hilqdi;
- static void Decode(int input)
- {
- hilqdi = input / 1000;
- input = input % 1000;
- stotici = input / 100;
- input = input % 100;
- desetici = input / 10;
- input = input % 10;
- edinici = input;
- }
- static bool Test()
- {
- if (hilqdi > 0)
- {
- if (N % hilqdi > 0)
- return false;
- }
- else
- return false;
- if (stotici > 0)
- {
- if (N % stotici > 0)
- return false;
- }
- else
- return false;
- if (desetici > 0)
- {
- if (N % desetici > 0)
- return false;
- }
- else
- return false;
- if (edinici > 0)
- {
- if (N % edinici > 0)
- return false;
- }
- else
- return false;
- return true;
- }
- static void Main(string[] args)
- {
- N = int.Parse(Console.ReadLine());
- for (i = 1111; i < 10000; i++)
- {
- Decode(i);
- if (Test())
- {
- Console.Write(i + " ");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement