Advertisement
Guest User

Untitled

a guest
Nov 21st, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. using System;
  2. using System.Globalization;
  3. namespace exercise{
  4. class exercise{
  5. static void Main(){
  6. int M = int.Parse(Console.ReadLine());
  7. int a ,A = 0;
  8. int b ,B = 0;
  9. int c ,C = 0;
  10. int d ,D = 0;
  11. int br= 0;
  12. for (int i = 1; i <= 9; i++)
  13. {
  14. a=i;
  15.  
  16. for (int j = 1; j <= 9; j++)
  17. {
  18. b=j;
  19.  
  20. for (int q = 1; q <= 9; q++)
  21. {
  22. c=q;
  23. for (int w = 1; w <= 9; w++)
  24. {
  25. d=w;
  26. if (a<b)
  27. {
  28. if(c>d)
  29. {
  30. if ((a*b+c*d)==M)
  31. {
  32. System.Console.Write("{0}{1}{2}{3} ",a,b,c,d);
  33. br++;
  34. if(br==4)
  35. {
  36. A=a;
  37. B=b;
  38. C=c;
  39. D=d;
  40. }
  41. }
  42. }
  43. }
  44.  
  45. }
  46. }
  47. }
  48.  
  49. }
  50. System.Console.WriteLine();
  51.  
  52. if (br>=4)
  53. {
  54. Console.WriteLine($"Password: {A}{B}{C}{D}");
  55. }
  56. else
  57. {
  58. Console.WriteLine("No!");
  59. }
  60.  
  61. }
  62. }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement