Your program is working: the line
system("pause");
Suspends the current task, so you can look at the output (but in a very inefficient way - use getchar() instead, and always print something alone the lines of "Press any key to continue" before you call it).
It just didn't take very long to execute.
Try adding printf statements before and after each loop to track the progress - you can always take them out later!