Advertisement
viraco4a

14. Magic Letter

May 22nd, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 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 _14_Magic_Letter
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. char first = char.Parse(Console.ReadLine());
  14. char second = char.Parse(Console.ReadLine());
  15. char third = char.Parse(Console.ReadLine());
  16. char min = GetMin(first, second);
  17. char max = GetMax(first, second);
  18. StringBuilder Everything = new StringBuilder();
  19. for (char i = min; i <= max; i++)
  20. {
  21. for (char j = min; j <= max; j++)
  22. {
  23. for (char k = min; k <= max; k++)
  24. {
  25. if (i != third && j != third && k != third)
  26. {
  27. string iString = new string(i, 1);
  28. string jString = new string(j, 1);
  29. string kString = new string(k, 1);
  30.  
  31. Everything.Append(iString + jString + kString + " ");
  32. }
  33. }
  34. }
  35. }
  36. string final = Everything.ToString();
  37. Console.WriteLine(final);
  38. }
  39.  
  40. private static char GetMax(char first, char second)
  41. {
  42. char max = first;
  43. if (first < second)
  44. {
  45. max = second;
  46. }
  47.  
  48. return max;
  49. }
  50.  
  51. private static char GetMin(char first, char second)
  52. {
  53. char min = first;
  54. if (first > second)
  55. {
  56. min = second;
  57. }
  58.  
  59. return min;
  60. }
  61. }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement