Tuesday 2 August 2016

Print India Map in C# Console Window.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace IndiaMap
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] data = {20,6,74,10,71,15,67,14,64,15,66,12,68,12,70,12,68,8,72,10,69,14,64,16,63,16,34,
                           5,23,19,31,10,19,23,17,1,9,10,15,30,14,2,5,12,16,37,8,2,6,8,20,61,20,46,1,12,
                            22,44,2,12,15,6,1,43,8,6,15,53,6,5,20,48,8,3,19,52,8,1,21,6,1,39,35,5,1,37,44,
                            35,44,35,46,30,50,30,50,28,52,26,54,25,56,24,57,20,60,19,62,16,65,16,64,15,66,
                            14,67,12,68,12,68,12,70,8,72,6,75,4,52,0
                         };
            int c = 0;
            int linecount = 0;
            for (int b = 0; data[b]  != 0; b++)
            {
                for (int a = data[b]; a >0; a--)
                {
                    c++;
                    if (c==80)
                    {
                        c = 0;
                        Console.WriteLine();
                        linecount++;
                    }
                    else if (b%2==0)
                    {
                        Console.Write(" ");
                    }
                    else
                    {
                        if (linecount<16)
                        {
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.Write("!");
                        }
                        else if (linecount>15 && linecount<31)
                        {
                            Console.ForegroundColor = ConsoleColor.White;
                            Console.Write("!");
                        }
                        else
                        {
                            Console.ForegroundColor = ConsoleColor.Green;
                            Console.Write("!");
                        }
                       
                    }
                }
            }
            Console.WriteLine();
            Console.CursorSize = 15;
            Console.WriteLine("I Love My India - Chandra Kant Hatwal");
            Console.Read();
        }
    }
}


Out Put


1 comment:

  1. VERY NICE..... Shandar, Zabardast, Zindabad.....................

    ReplyDelete

SQL Table : Change Row As Column and Group Them... ( Setting column values as column names in the SQL query result )

Setting column values as column names in the SQL query result Problem Statement : id col1 col2 1 Pending 30 1 Resolved 48 ...