The short answer: The program tries all possible values for each cell, and the combination which obeys all sudoku's rule is displayed as the solution.
The long answer:
void func(){
//do something
func(); //function calling itself
}
long factorial(int n){
if (n == 0)
return 1;
else
return (n * factorial(n-1));
}