Advertisement
Djugalov

Untitled

Oct 15th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 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 ConsoleApplication1
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int counterForLuckyTickets = 0;
  14. int counterForNormalTickets = 0;
  15. int totalTickets = counterForLuckyTickets + counterForNormalTickets;
  16. for(int a = 1; a <= 9; a++)
  17. {
  18. for(int b = 0; b <= 9; b++)
  19. {
  20. for(int c = 0; c <= 9; c++)
  21. {
  22. for(int d = 0; d <= 9; d++)
  23. {
  24. for(int e = 0; e <= 9; e++)
  25. {
  26. for(int f = 0; f <= 9; f++)
  27. {
  28. if ((a + b + c) == (d + e + f))
  29. {
  30. counterForLuckyTickets++;
  31. string resultLuckyTickets = a + " " + b + " " + c + " " + d + " " + e + " " + f;
  32. Console.WriteLine(resultLuckyTickets);
  33. }
  34. else if ((a + b + c) != (d + e + f))
  35. {
  36. counterForNormalTickets++;
  37. }
  38. }
  39. }
  40. }
  41. }
  42. }
  43. }
  44. Console.WriteLine("Total lucky ticket numbers are:{0}",counterForLuckyTickets);
  45. Console.WriteLine("Total not lucky ticket numbers are:{0}",counterForNormalTickets);
  46. Console.WriteLine("Total tickets existing are:{0}", totalTickets);
  47. }
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement