Brainfuck, 129 bytes
I know there's already a shorter answer in brainfuck, however I wanted to create a program which could handle a multi-digit number input rather than either a single-digit input or a single ascii character input unlike the previous one posted.
,[>+++[->++++[-<<---->>]<]+>,]<-<<[<<]>>[<[->>++++++++++<<]>>>]+>>++++++++++>>++++++[-<+++++++>]<<<<<[>[->+>>.<<<]>>.<[-<+>]<+<-]
This is my first ever brainfuck program and it will work for any input between 0 and the maximum size of a single cell (traditionally 8 bits or 255) entered using the characters '0' to '9' (corresponding to ascii-values 048-057)
Explanation
The first part of this program, ,[>+++[->++++[-<<---->>]<]+>,]
, takes the input numbers as char values and removes 48 from each to make them equal to the numbers 0 to 9 rather than the char values of the numbers 0 to 9. It stores these in separate cells with a 1 in between each of them so that the start and end points can be found again.
The second part, <-<<[<<]>>[<[->>++++++++++<<]>>>]
, consolidates the separate values into one cell. This is why the maximum size of a cell controls how high a number can be.
The third section, +>>++++++++++>>++++++[-<+++++++>]<<<<<
, is used to set up the other cells needed: one with the number of asterisks per line, one with the code for a linefeed and one with the code for an asterisk. There is also a blank cell left for working with later.
The remainder of the code, [>[->+>>.<<<]>>.<[-<+>]<+<-]
, is used to:
- Output as many asterisks as necessary
- Output a linefeed
- Reset the value of the cell controlling the asterisks
- Increment the control cell
- Decrement the cell with the number until it equals 0