Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class OnesAndZeros
- {
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- string mask = "";
- for (int i = 0; i < 16; i++)
- mask += (n >> i) & 1;
- string temp = mask;
- for (int cols = 0; cols < 5; cols++)
- {
- for (int rows = 0; rows < 16; rows++)
- {
- if (mask.Substring(mask.Length - 1) == "0")
- {
- if (cols == 0 || cols == 4)
- Console.Write("###");
- else if (cols > 0 && cols < 4)
- Console.Write("#.#");
- }
- else if (mask.Substring(mask.Length - 1) == "1")
- {
- if (cols == 0 || cols == 2 || cols == 3)
- Console.Write(".#.");
- else if (cols == 1)
- Console.Write("##.");
- else if (cols == 4)
- Console.Write("###");
- }
- if (rows < 15)
- Console.Write(".");
- mask = mask.Substring(0, mask.Length - 1);
- }
- Console.WriteLine();
- mask = temp;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement