Puzzles

Puzzles

C Program to Solve Tower of Hanoi Problem using Recursion

The tower of hanoi is a mathematical puzzle. It consists of three rods, and a number of disks of different sizes which can slide onto any rod. The puzzle starts with the disks in a neat stack in ascending order of size on one rod, the smallest at the top. We have to obtain the same stack on the...

C Program to Solve the Magic Squares Puzzle

The following C program finds the magic square for a given odd sized number, using iteration. A magic square is an arrangement of numbers from 1 to n^2 in an matrix, with each number occurring exactly once, and such that the sum of the entries of any row, any column, or any main diagonal is the same. Here is...