In your first program, you have done a silly mistake.
In that, you print the array after every pass. In the printing loop of an array, you have used "i" variable which is also used in your main for loop of bubble sort so after the first iteration of bubble sort i's value becomes 5 and because of that reason your main loop is terminated.
So whatever result you get in your first program is the only a result of bubble sort's first pass.