Code to print pascals triangle - works correctly