Tags

, , , , ,

Happy 2015

(never forget to check the quiz below and comment the answer, I might give some prices to a lucky winner, seriously)

Happy New Year to all. May this 2015 brings you a peaceful mind && make you strong, geeky and || or nerdy.

While I come through my twitter timeline today I noticed that the Binary(2015) is a palindrome number, that is 11111011111 wow thats amazing right. So I wanted to create an app to find which years return palindrome binary numbers.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;

namespace PalindromeCheck
{
    class Program
    {
        static void Main(string[] args)
        {
            string initial = "";
 
            Console.WriteLine("Enter a Year to check for Palindrome");
            
            string decInput = Console.ReadLine();
 
            string binInput = Convert.ToString(Convert.ToInt32(decInput),2);
 
            int binInputLen = binInput.Length;

            if (binInputLen == 0)
            {
                Console.WriteLine("You did not enter the string");

            }

            else
            {

                for (int j = binInputLen - 1; j >= 0; j--)
                {
                    initial = initial + binInput[j];
                }

                if (initial == binInput)
                {
                    Console.WriteLine(String.Format("Year {0} returns a palindrome binary, that is {1}",decInput,binInput));
                }
                else
                {
                    Console.WriteLine(String.Format("Year {0} does not returns a palindrome binary, which is {1}", decInput, binInput));
                }
                Console.Read();
            }
        }
    }
}

This is hope you enjoy this. Happy coding peeps 🙂


Happy New year again.

 

QUIZ : What is the next.next year to return a octal Palindrome number?
Deadline -> Answer is the deadline, until that the quiz is open.

Advertisements