Wednesday, 14 August 2013

C program to print INDIA MAP

Happy independence day !!!!!!!!!!!

C program to print INDIA MAP

#include<stdio.h>
void main()
{
int a,b,c;
for (b=c=10;a="- FIGURE?, UMKC,XYZHello Folks,\
TFy!QJu ROo TNn(ROo)SLq SLq ULo+\
UHs UJq TNn*RPn/QPbEWS_JSWQAIJO^\
NBELPeHBFHT}TnALVlBLOFAkHFOuFETp\
HCStHAUFAgcEAelclcn^r^r\\tZvYxXy\
T|S~Pn SPm SOn TNn ULo0ULo#ULo-W\
Hq!WFs XDt!" [b+++21]; ) {
for(; a-- > 64 ; )
{
putchar ( ++c=='Z' ? c = c/ 9:33^b&1);
}
}
}

Here is the output of the above program


4 comments:

  1. How did you figure this out!

    ReplyDelete
  2. 33 is ASCII value of '!' and 32 is of 'space' so depending on b either even of odd it prints either space or '!'

    string starts from 31 th character (b+++21 =31) before 31 all character are uselss

    After 31, string contains encoding map of india image eg "TFy!QJu ..." The individual characters (like T,F,y,!,Q,.) determine how many spaces or exclamation marks (!) to draw consecutively

    This outer loop goes over the characters in the string. Each iteration increases the value of b by one, and assigns the next character in the string to a.
    This inner loop draws individual characters, and a newline whenever it reaches the end of line. The number of characters drawn is a - 64. The value of c goes from 10 to 90, and resets to 10 when the end of line is reached.

    ReplyDelete

  3. Thanks so much for the comment. I try to put together my learning and experiece in terms of blog and feel great if this helps others.

    Angularjs Development Company - Nintriva

    ReplyDelete