We're dividing 40167758 by 791 
Our goal is to divide 40167758 by 791.

Step 1:
The number 791 fits into 4 0 times, leaving a remainder of 4.
Record the quotient 0 as the next digit in the result. 
Result so far: 0.0
Deduct 0 from 4 and we're left with 4.
Append the next digit (0) from the dividend to 4 and continue with: 40 / 791

Moving on to step 2:
If we divide 40 by 791, we get 0 and a remainder of 40.
Use 0 as the next digit of our solution. 
Result so far: 0.0
The remainder is 40 after subtracting 0 from 40.
Fetch the next digit (1) from the dividend, attach it to 40 and continue: 401 / 791

Moving on to step 3:
If we divide 401 by 791, we get 0 and a remainder of 401.
The next digit of our result is 0. 
Result so far: 0.0
Deduct 0 from 401 and we're left with 401.
Grab the next digit (6) from the dividend, add it to 401, then carry on: 4016 / 791

On to step 4:
4016 divided by 791 is 5 with a remainder of 61.
Write down 5 as next digit of the result. 
Result so far: 5.0
If we subtract 3955 from 4016, we get 61.
Bring next digit (7) of the dividend behind the 61 and repeat the process: 617 / 791

Let's proceed to step 5:
791 can be fit into 617 0 times, resulting in a remainder of 617.
The next digit of our result is 0. 
Result so far: 50.0
Deduct 0 from 617 and we're left with 617.
Grab the next digit (7) from the dividend, add it to 617, then carry on: 6177 / 791

Going ahead to step 6:
791 goes into 6177 7 times with a remainder of 640.
Write down 7 as next digit of the result. 
Result so far: 507.0
If we take 5537 away from 6177, we end up with 640.
Include the next digit (5) from the dividend after 640, then repeat: 6405 / 791

Advancing to step 7:
791 can be fit into 6405 8 times, resulting in a remainder of 77.
The next digit of our result is 8. 
Result so far: 5078.0
Subtracting 6328 from 6405 leaves us with 77.
Include the next digit (8) from the dividend after 77, then repeat: 778 / 791

Going ahead to step 8:
The number 791 fits into 778 0 times, leaving a remainder of 778.
Put 0 as the next digit of the answer. 
Result so far: 50780.0
If we subtract 0 from 778, we get 778.
Since there are no more digits in the dividend, we add a zero to the remainder making it 7780, and continue the process.

Advancing to step 9:
791 goes into 7780 9 times with a remainder of 661.
The next digit of our result is 9. 
Result so far: 50780.9
Subtract 7119 from 7780 to get 661.
Since there are no more digits in the dividend, we add a zero to the remainder making it 6610, and continue the process.

Advancing to step 10:
When dividing 6610 by 791, we get 8 with a remainder of 282.
Use 8 as the next digit of our solution. 
Result so far: 50780.98
Deduct 6328 from 6610 and we're left with 282.
Since there are no more digits in the dividend, we add a zero to the remainder making it 2820, and continue the process.

Step 11:
The number 791 fits into 2820 3 times, leaving a remainder of 447.
Use 3 as the next digit of our solution. 
Result so far: 50780.983
If we take 2373 away from 2820, we end up with 447.
Since there are no more digits in the dividend, we add a zero to the remainder making it 4470, and continue the process.

On to step 12:
When dividing 4470 by 791, we get 5 with a remainder of 515.
The number 5 becomes the next digit in our result. 
Result so far: 50780.9835
If we take 3955 away from 4470, we end up with 515.
Since there are no more digits in the dividend, we add a zero to the remainder making it 5150, and continue the process.

Going ahead to step 13:
If we divide 5150 by 791, we get 6 and a remainder of 404.
The number 6 becomes the next digit in our result. 
Result so far: 50780.98356
Subtracting 4746 from 5150 leaves us with 404.
Since there are no more digits in the dividend, we add a zero to the remainder making it 4040, and continue the process.

Step 14:
791 goes into 4040 5 times with a remainder of 85.
Record the quotient 5 as the next digit in the result. 
Result so far: 50780.983565
Subtracting 3955 from 4040 leaves us with 85.
Since there are no more digits in the dividend, we add a zero to the remainder making it 850, and continue the process.

Advancing to step 15:
850 divided by 791 is 1 with a remainder of 59.
Put 1 as the next digit of the answer. 
Result so far: 50780.9835651
The remainder is 59 after subtracting 791 from 850.
Since there are no more digits in the dividend, we add a zero to the remainder making it 590, and continue the process.

Step 16:
590 divided by 791 is 0 with a remainder of 590.
The number 0 becomes the next digit in our result. 
Result so far: 50780.9835651
If we subtract 0 from 590, we get 590.
Since there are no more digits in the dividend, we add a zero to the remainder making it 5900, and continue the process.

After the division, we end up with 50780.9835651 and a remainder of 5.9e-07.