We're dividing 51165 by 40 
We want to figure out the number of times 51165 can be divided by 40.

On to step 1:
40 goes into 5 0 times with a remainder of 5.
The next digit of our result is 0. 
Result so far: 0.0
If we subtract 0 from 5, we get 5.
Bring next digit (1) of the dividend behind the 5 and repeat the process: 51 / 40

Step 2:
The number 40 fits into 51 1 times, leaving a remainder of 11.
Record the quotient 1 as the next digit in the result. 
Result so far: 1.0
Deduct 40 from 51 and we're left with 11.
Take the next digit (1) from the dividend and append it to 11, then repeat: 111 / 40

Step 3:
If we divide 111 by 40, we get 2 and a remainder of 31.
Write down 2 as next digit of the result. 
Result so far: 12.0
Subtracting 80 from 111 leaves us with 31.
Append the next digit (6) from the dividend to 31 and continue with: 316 / 40

Advancing to step 4:
40 can be fit into 316 7 times, resulting in a remainder of 36.
Use 7 as the next digit of our solution. 
Result so far: 127.0
Subtract 280 from 316 to get 36.
Include the next digit (5) from the dividend after 36, then repeat: 365 / 40

Let's proceed to step 5:
If we divide 365 by 40, we get 9 and a remainder of 5.
Record the quotient 9 as the next digit in the result. 
Result so far: 1279.0
Deduct 360 from 365 and we're left with 5.
Since there are no more digits in the dividend, we add a zero to the remainder making it 50, and continue the process.

Step 6:
40 goes into 50 1 times with a remainder of 10.
Put 1 as the next digit of the answer. 
Result so far: 1279.1
If we subtract 40 from 50, we get 10.
Since there are no more digits in the dividend, we add a zero to the remainder making it 100, and continue the process.

Going ahead to step 7:
40 can be fit into 100 2 times, resulting in a remainder of 20.
The number 2 becomes the next digit in our result. 
Result so far: 1279.12
Subtract 80 from 100 to get 20.
Since there are no more digits in the dividend, we add a zero to the remainder making it 200, and continue the process.

Moving on to step 8:
If we divide 200 by 40, we get 5 and a remainder of 0.
Write down 5 as next digit of the result. 
Result so far: 1279.125
If we take 200 away from 200, we end up with 0.
Since there are no more digits in the dividend, we add a zero to the remainder making it 0, and continue the process.

Moving on to step 9:
The number 40 fits into 0 0 times, leaving a remainder of 0.
Put 0 as the next digit of the answer. 
Result so far: 1279.125
Subtracting 0 from 0 leaves us with 0.
Since there are no more digits in the dividend, we add a zero to the remainder making it 0, and continue the process.

Advancing to step 10:
40 can be fit into 0 0 times, resulting in a remainder of 0.
Use 0 as the next digit of our solution. 
Result so far: 1279.125
If we take 0 away from 0, we end up with 0.
Since there are no more digits in the dividend, we add a zero to the remainder making it 0, and continue the process.

The quotient of the division is 1279.125, and the remainder is 0.0.