Advertisement
Guest User

Untitled

a guest
Apr 11th, 2014
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. using System;
  2.  
  3. class OnesAndZeros
  4. {
  5. static void Main()
  6. {
  7. int n = int.Parse(Console.ReadLine());
  8. string mask = "";
  9.  
  10. for (int i = 0; i < 16; i++)
  11. mask += (n >> i) & 1;
  12.  
  13. string temp = mask;
  14.  
  15. for (int cols = 0; cols < 5; cols++)
  16. {
  17. for (int rows = 0; rows < 16; rows++)
  18. {
  19. if (mask.Substring(mask.Length - 1) == "0")
  20. {
  21. if (cols == 0 || cols == 4)
  22. Console.Write("###");
  23. else if (cols > 0 && cols < 4)
  24. Console.Write("#.#");
  25. }
  26. else if (mask.Substring(mask.Length - 1) == "1")
  27. {
  28. if (cols == 0 || cols == 2 || cols == 3)
  29. Console.Write(".#.");
  30. else if (cols == 1)
  31. Console.Write("##.");
  32. else if (cols == 4)
  33. Console.Write("###");
  34. }
  35. if (rows < 15)
  36. Console.Write(".");
  37.  
  38. mask = mask.Substring(0, mask.Length - 1);
  39. }
  40. Console.WriteLine();
  41. mask = temp;
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement