Showing posts with label Codies. Show all posts
Showing posts with label Codies. Show all posts

Wednesday, January 13, 2010

CODIES 1.3

###### TREAT QUESTION ######

There is a concept of some magic numbers like we have numbers from 1 to some big number and we follow some iterations on the initial sequence of numbers: 1 2 3 4 5 6 7 8......

1) In first iteration we delete the numbers leaving one gap that is we delete numbers 2 4 6 8….. Therefore now the remaining numbers are 1 3 5 7 9 11 13 15 17 19................
2) In second iteration we delete numbers leaving two gaps, hence after it left no.s are 1 3 7 9 13 15 19 21……
3) Then we delete no.s leaving 3 gaps and hence left nos. are 1 3 7 13 15 19 25…….

The numbers which are never deleted are termed as magic number.
Write a function, given a number, that whether a number is a magic no. or not.


###### TREAT QUESTION ######

Thursday, December 31, 2009

CODIES 1.2

First of all congrates to Guru and Prabhat for their perfect explanation to CODIES 1.1. You will get your treat (I am sorry for such a delay ) along with the winner of CODIES 1.3, the next post. I am sure you gonna love the next question, it's a good one. Right now here i am up with one another question - CODIES 1.2:-

int main()
{
printf("%s", "technoprax");
return 0;
}


Que : Output "prax" from the above code snippet. You are allowed only to add/replace 2 characters in the code.

Monday, November 2, 2009

CODIES 1.1

Point out the difference between the two structure declarations:

struct one
{
char charA;
short shortA;
char charB;
long longA;
char charC;
}

struct two
{
long longA;
char charA,charB,charC;
short shortA;
}

A good detailed explanation wins a treat !!!