Sunday, March 1, 2015

Towers of Cards

Radha and Sunaina were proficient in building towers with cards. Laila was a spoil sport. She would wait for the tower to fall on its own due to unskilled card placement or she would just pull a card from a finished structure.
Radha decided to make a tower of a cylinder as high as possible. Sunaina wanted to build a Qutab Minar shape with cards. Laila was secretly observing their work from a hidden place and was waiting for the completion of structure and then pull a card.
Radha kept building the tower of a cylinder. Sunaina was able to complete her Qutab Minar, when Laila removed one card from Sunaina's structure and make the Qutab Minar fall down.
Laila proudly says,"I have won !!"
Sunaina replies back, "Hardly !!". How?


Kirtivasan Ganesan said...

Sunaina is unhappy. But she has completed. And hence she says, "Hardly".

Kirtivasan Ganesan said...

This is based on for loops and changing the value after completion logic.