We're dividing 786171 by 40 
We want to divide 786171 by 40.

Going ahead to step 1:
40 goes into 7 0 times with a remainder of 7.
The next digit of our result is 0. 
Result so far: 0.0
If we subtract 0 from 7, we get 7.
Include the next digit (8) from the dividend after 7, then repeat: 78 / 40

Moving on to step 2:
When dividing 78 by 40, we get 1 with a remainder of 38.
The number 1 becomes the next digit in our result. 
Result so far: 1.0
Deduct 40 from 78 and we're left with 38.
Fetch the next digit (6) from the dividend, attach it to 38 and continue: 386 / 40

On to step 3:
When dividing 386 by 40, we get 9 with a remainder of 26.
Put 9 as the next digit of the answer. 
Result so far: 19.0
Subtracting 360 from 386 leaves us with 26.
Append the next digit (1) from the dividend to 26 and continue with: 261 / 40

On to step 4:
The number 40 fits into 261 6 times, leaving a remainder of 21.
The number 6 becomes the next digit in our result. 
Result so far: 196.0
Subtracting 240 from 261 leaves us with 21.
Take the next digit (7) from the dividend and append it to 21, then repeat: 217 / 40

Going ahead to step 5:
40 can be fit into 217 5 times, resulting in a remainder of 17.
Write down 5 as next digit of the result. 
Result so far: 1965.0
If we subtract 200 from 217, we get 17.
Include the next digit (1) from the dividend after 17, then repeat: 171 / 40

Let's proceed to step 6:
The number 40 fits into 171 4 times, leaving a remainder of 11.
The number 4 becomes the next digit in our result. 
Result so far: 19654.0
The remainder is 11 after subtracting 160 from 171.
Since there are no more digits in the dividend, we add a zero to the remainder making it 110, and continue the process.

On to step 7:
When dividing 110 by 40, we get 2 with a remainder of 30.
Use 2 as the next digit of our solution. 
Result so far: 19654.2
Deduct 80 from 110 and we're left with 30.
Since there are no more digits in the dividend, we add a zero to the remainder making it 300, and continue the process.

Step 8:
40 goes into 300 7 times with a remainder of 20.
Put 7 as the next digit of the answer. 
Result so far: 19654.27
If we take 280 away from 300, we end up with 20.
Since there are no more digits in the dividend, we add a zero to the remainder making it 200, and continue the process.

Step 9:
40 goes into 200 5 times with a remainder of 0.
Record the quotient 5 as the next digit in the result. 
Result so far: 19654.275
The remainder is 0 after subtracting 200 from 200.
Since there are no more digits in the dividend, we add a zero to the remainder making it 0, and continue the process.

Going ahead to step 10:
If we divide 0 by 40, we get 0 and a remainder of 0.
The next digit of our result is 0. 
Result so far: 19654.275
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.

Let's proceed to step 11:
0 divided by 40 is 0 with a remainder of 0.
The number 0 becomes the next digit in our result. 
Result so far: 19654.275
If we subtract 0 from 0, we get 0.
Since there are no more digits in the dividend, we add a zero to the remainder making it 0, and continue the process.

Our division results in 19654.275 with a remaining 0.0.