Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- class ThirdTask
- {
- static void Main()
- {
- StringBuilder firstSB = new StringBuilder();
- StringBuilder secondSB = new StringBuilder();
- StringBuilder thirdSB = new StringBuilder();
- StringBuilder fourthSB = new StringBuilder();
- int number = int.Parse(Console.ReadLine());
- for (int i = 15; i >= 0; i--)
- {
- int mask = 1 << i;
- int numberAndMask = number & mask;
- int bit = numberAndMask >> i;
- if (bit == 1)
- {
- firstSB.Append(".#.");
- secondSB.Append("##.");
- thirdSB.Append(".#.");
- fourthSB.Append("###");
- }
- else
- {
- firstSB.Append("###");
- secondSB.Append("#.#");
- thirdSB.Append("#.#");
- fourthSB.Append("###");
- }
- if (i != 0)
- {
- firstSB.Append(".");
- secondSB.Append(".");
- thirdSB.Append(".");
- fourthSB.Append(".");
- }
- }
- Console.WriteLine(firstSB.ToString());
- Console.WriteLine(secondSB.ToString());
- Console.WriteLine(thirdSB.ToString());
- Console.WriteLine(fourthSB.ToString());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment