38871 ÷ 40 
Let's see how many times 40 fits into 38871.

On to step 1:
If we divide 3 by 40, we get 0 and a remainder of 3.
Record the quotient 0 as the next digit in the result. 
Result so far: 0.0
The remainder is 3 after subtracting 0 from 3.
Include the next digit (8) from the dividend after 3, then repeat: 38 / 40

Moving on to step 2:
40 goes into 38 0 times with a remainder of 38.
The number 0 becomes the next digit in our result. 
Result so far: 0.0
Subtract 0 from 38 to get 38.
Grab the next digit (8) from the dividend, add it to 38, then carry on: 388 / 40

Moving on to step 3:
The number 40 fits into 388 9 times, leaving a remainder of 28.
The number 9 becomes the next digit in our result. 
Result so far: 9.0
If we take 360 away from 388, we end up with 28.
Take the next digit (7) from the dividend and append it to 28, then repeat: 287 / 40

Advancing to step 4:
287 divided by 40 is 7 with a remainder of 7.
Record the quotient 7 as the next digit in the result. 
Result so far: 97.0
The remainder is 7 after subtracting 280 from 287.
Take the next digit (1) from the dividend and append it to 7, then repeat: 71 / 40

On to step 5:
40 can be fit into 71 1 times, resulting in a remainder of 31.
Record the quotient 1 as the next digit in the result. 
Result so far: 971.0
Subtract 40 from 71 to get 31.
Since there are no more digits in the dividend, we add a zero to the remainder making it 310, and continue the process.

Step 6:
40 goes into 310 7 times with a remainder of 30.
Record the quotient 7 as the next digit in the result. 
Result so far: 971.7
Subtract 280 from 310 to get 30.
Since there are no more digits in the dividend, we add a zero to the remainder making it 300, and continue the process.

Going ahead to step 7:
300 divided by 40 is 7 with a remainder of 20.
The number 7 becomes the next digit in our result. 
Result so far: 971.77
Subtracting 280 from 300 leaves us 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.

The final result is 971.77 with a remainder of 0.02.