Monday, 1 August 2016

C program to print map of India.


#include  <stdio.h>

void main()
{
    char 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 a,b,c=0;
   
    for (b=0; data[b] != 0; b++)
    {
       for(a = data[b]; a > 0 ; a--)
       {
           c++;
           if (c == 80)
           {
               c = 0;
               putchar('\n');
           }
           else if (b%2 == 0)
           {
               putchar(' ');
           }
           else
           {
               putchar('!');
           }
       }
    }
}

o/p

No comments:

Post a Comment

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 ...