Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Riddle
- {
- class Program
- {
- public static void Main(string[] args)
- {
- int Ш, Р, А, М, Ы;
- int ШРАМ,
- МАРШ;
- for(Ш = 0; Ш <= 9; Ш++)
- for(Р = 0; Р <= 9; Р++)
- if(Р != Ш)
- for(А = 0; А <= 9; А++)
- if(А != Р && А != Ш)
- for(М = 0; М <= 9; М++)
- if(М != А && М != Р && М != Ш)
- for(Ы = 0; Ы <= 9; Ы++)
- {
- if(Ы != М && Ы != А && Ы != Р && Ы != Ш)
- {
- ШРАМ = Ш * 1000 + Р * 100 + А * 10 + М;
- МАРШ = М * 1000 + А * 100 + Р * 10 + Ш;
- if(ШРАМ * Ы == МАРШ)
- {
- Console.WriteLine(М.ToString() + А.ToString() + Р.ToString() + Ш.ToString());
- }
- }
- }
- Console.ReadLine();
- }
- }
- }
Add Comment
Please, Sign In to add comment