Advertisement
Guest User

Untitled

a guest
Dec 14th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace exam
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. var controlValue = int.Parse(Console.ReadLine());
  14. var n = 0;
  15. var pas = 0;
  16. for (int number = 1000; number < 10000; number++)
  17. {
  18. var firstDigit = number / 1000;
  19. var lastDigit = number % 10;
  20. var thirdDigit = (number / 10) % 10;
  21. var secondDigit = (number / 100) % 10;
  22.  
  23. if (controlValue==firstDigit*secondDigit + thirdDigit*lastDigit && firstDigit<secondDigit && thirdDigit>lastDigit)
  24. {
  25. n++;
  26. if (n==4)
  27. {
  28. pas += number;
  29. }
  30. Console.Write(number);
  31. Console.Write(" ");
  32. }
  33. }
  34. if (n < 4)
  35. {
  36.  
  37. }
  38.  
  39. else
  40. {
  41. Console.WriteLine($"Password: {pas}");
  42. }
  43.  
  44.  
  45. }//MAin
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement