Hexagony, 14 12 bytes
(}?@_.)<!>*' Layed out
( } ? @ _ . ) < ! > * ' . . . . . . . Explanation
(}? some irrelevant operations initially, then get the input
< branch, if 0 go to @ and terminate, otherwise point the IP southeast
(_ decrement the input cell and redirect the IP northeast
}*)! move the MP to the cell to the right, set that cell to 1 and print that out
_> redirect the IP back east
*' irrelevant operation, then move the MP back to the input cell
this then loops back to the branch command