aneliabogeva

Untitled

Apr 5th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 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 _Ticket_Combination
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int number = int.Parse(Console.ReadLine());
  14. string combination = string.Empty;
  15. int counter = 0;
  16.  
  17.  
  18. if (number >= 1 && number <= 10000)
  19. {
  20. for (int j = 66; j <= 76; j++)
  21. {
  22. for (int k = 102; k >= 97; k--)
  23. {
  24. for (int m = 65; m <= 67; m++)
  25. {
  26. for (int h = 1; h <= 10; h++)
  27. {
  28. for (int g = 10; g >= 1; g--)
  29. {
  30. char first = (char)(j);
  31. char second = (char)(k);
  32. char third = (char)(m);
  33.  
  34. //combination = $"{first}{second}{third}{h}{g}";
  35.  
  36. if (j % 2 == 0)
  37. {
  38. combination = $"{first}{second}{third}{h}{g}";
  39. int price = j + k + m + h + g;
  40. counter++;
  41. if (counter == number)
  42. {
  43. Console.WriteLine($"Ticket combination: {first}{second}{third}{h}{g}");
  44.  
  45. Console.WriteLine($"Prize: {price} lv.");
  46. }
  47. }
  48.  
  49. else
  50. {
  51. break;
  52. }
  53. }
  54. }
  55. }
  56. }
  57. }
  58. }
  59. else
  60. {
  61. Console.WriteLine("Input a valid number for the combination!");
  62. }
  63. }
  64. }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment