789166 divided by 40 
We're looking to find how many times 40 goes into 789166.

Let's proceed to step 1:
40 can be fit into 7 0 times, resulting in a remainder of 7.
Record the quotient 0 as the next digit in the result. 
Result so far: 0.0
Subtract 0 from 7 to get 7.
Bring next digit (8) of the dividend behind the 7 and repeat the process: 78 / 40

Going ahead to step 2:
40 can be fit into 78 1 times, resulting in a remainder of 38.
Put 1 as the next digit of the answer. 
Result so far: 1.0
If we take 40 away from 78, we end up with 38.
Grab the next digit (9) from the dividend, add it to 38, then carry on: 389 / 40

Advancing to step 3:
40 goes into 389 9 times with a remainder of 29.
Put 9 as the next digit of the answer. 
Result so far: 19.0
If we subtract 360 from 389, we get 29.
Fetch the next digit (1) from the dividend, attach it to 29 and continue: 291 / 40

Step 4:
When dividing 291 by 40, we get 7 with a remainder of 11.
Use 7 as the next digit of our solution. 
Result so far: 197.0
Subtracting 280 from 291 leaves us with 11.
Take the next digit (6) from the dividend and append it to 11, then repeat: 116 / 40

Step 5:
40 goes into 116 2 times with a remainder of 36.
Put 2 as the next digit of the answer. 
Result so far: 1972.0
Subtracting 80 from 116 leaves us with 36.
Bring next digit (6) of the dividend behind the 36 and repeat the process: 366 / 40

Let's proceed to step 6:
When dividing 366 by 40, we get 9 with a remainder of 6.
Record the quotient 9 as the next digit in the result. 
Result so far: 19729.0
If we take 360 away from 366, we end up with 6.
Since there are no more digits in the dividend, we add a zero to the remainder making it 60, and continue the process.

On to step 7:
40 can be fit into 60 1 times, resulting in a remainder of 20.
Record the quotient 1 as the next digit in the result. 
Result so far: 19729.1
The remainder is 20 after subtracting 40 from 60.
Since there are no more digits in the dividend, we add a zero to the remainder making it 200, and continue the process.

Advancing to step 8:
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: 19729.15
Subtracting 200 from 200 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 9:
When dividing 0 by 40, we get 0 with a remainder of 0.
The next digit of our result is 0. 
Result so far: 19729.15
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.

On to step 10:
The number 40 fits into 0 0 times, leaving a remainder of 0.
The next digit of our result is 0. 
Result so far: 19729.15
Subtract 0 from 0 to 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.

The final outcome is 19729.15, with a leftover of 0.0.