Some Random Thoughts..
Just a place to put some random thoughts..

Hi,

Some days ago, I had posted about a simple programming riddle.
Here's my solution. Simple.. isnt it? But did you get it right in the first try? :)


int main(int argc, char *argv[])
{
int a = atoi(argv[1]);
while(a >= 0){
printf("%c", 'A'+a%26);
a = a/26 - 1;
}
return 0;
}



Yours Sinerely,
Answer to the riddle
Hi,

Some days ago, I had posted about a simple programming riddle.
Here's my solution. Simple.. isnt it? But did you get it right in the first try? :)


int main(int argc, char *argv[])
{
int a = atoi(argv[1]);
while(a >= 0){
printf("%c", 'A'+a%26);
a = a/26 - 1;
}
return 0;
}



Yours Sinerely,

posted by rumplestiltskin @ 2:52 pm 0 comments

0 Comments:


Post a Comment