We look at the division of 796540 by 40 
We're looking to find how many times 40 goes into 796540.

Going ahead to step 1:
7 divided by 40 is 0 with a remainder of 7.
Use 0 as the next digit of our solution. 
Result so far: 0.0
If we subtract 0 from 7, we get 7.
Fetch the next digit (9) from the dividend, attach it to 7 and continue: 79 / 40

Step 2:
40 can be fit into 79 1 times, resulting in a remainder of 39.
Record the quotient 1 as the next digit in the result. 
Result so far: 1.0
The remainder is 39 after subtracting 40 from 79.
Fetch the next digit (6) from the dividend, attach it to 39 and continue: 396 / 40

Going ahead to step 3:
When dividing 396 by 40, we get 9 with a remainder of 36.
Write down 9 as next digit of the result. 
Result so far: 19.0
Subtracting 360 from 396 leaves us with 36.
Fetch the next digit (5) from the dividend, attach it to 36 and continue: 365 / 40

Advancing to step 4:
When dividing 365 by 40, we get 9 with a remainder of 5.
The number 9 becomes the next digit in our result. 
Result so far: 199.0
If we subtract 360 from 365, we get 5.
Grab the next digit (4) from the dividend, add it to 5, then carry on: 54 / 40

Going ahead to step 5:
If we divide 54 by 40, we get 1 and a remainder of 14.
Put 1 as the next digit of the answer. 
Result so far: 1991.0
Subtracting 40 from 54 leaves us with 14.
Take the next digit (0) from the dividend and append it to 14, then repeat: 140 / 40

Moving on to step 6:
The number 40 fits into 140 3 times, leaving a remainder of 20.
Record the quotient 3 as the next digit in the result. 
Result so far: 19913.0
Subtract 120 from 140 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 7:
When dividing 200 by 40, we get 5 with a remainder of 0.
Write down 5 as next digit of the result. 
Result so far: 19913.5
If we subtract 200 from 200, 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.

Let's proceed to step 8:
40 goes into 0 0 times with a remainder of 0.
The next digit of our result is 0. 
Result so far: 19913.5
The remainder is 0 after subtracting 0 from 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:
If we divide 0 by 40, we get 0 and a remainder of 0.
Record the quotient 0 as the next digit in the result. 
Result so far: 19913.5
The remainder is 0 after subtracting 0 from 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 result is 19913.5 with a remainder of 0.0.