Is it possible to train the neural networks for programming
It depends on what kind of functionality you would want to achieve. In essence, a trained neural network is a mapping function, which takes some input and produces some output, which then may be variously interpreted (for example using a certain threshold for classification).

Therefore, if the desired functionality of your program would be coming up with a computational function, you could treat your trained neural network as the program itself. Multiple machine learning libraries allow that easily, producing a class instance which contains the trained neural network inside and allows you to call it with given parameters just like any other function.

However, I assume that you are looking for a way to output complex computer code with control structures, etc. - that unfortunately is very difficult to achieve, since you'd need an effective way to interpret the neural network outputs as code - not just the commands, but their structure and ordering as well. Such interpretations would be so complex that they'd make it very difficult for any Neural Network training method to converge to anything sensible.

To mitigate this problem, you can try machine learning techniques which manipulate and optimize the code "directly". The most famous of such is Genetic Programming - in which a computer program in encoded as a set of "genes" which are then improved upon through genetic algorithm techniques (crossovers which recombine large parts of code and mutations which randomly change small parts of the code). This has been successfully applied to some programming problems such as the Towers of Hanoi (see http://www.oakgp.org/towers-of-hanoi ).