We look at the division of 796698 by 40 
The aim is to understand the frequency of 40 in 796698.

Moving on to step 1:
The number 40 fits into 7 0 times, leaving a remainder of 7.
Write down 0 as next digit of the result. 
Result so far: 0.0
If we take 0 away from 7, we end up with 7.
Fetch the next digit (9) from the dividend, attach it to 7 and continue: 79 / 40

On to step 2:
If we divide 79 by 40, we get 1 and 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.
Take the next digit (6) from the dividend and append it to 39, then repeat: 396 / 40

Advancing to step 3:
40 can be fit into 396 9 times, resulting in a remainder of 36.
Write down 9 as next digit of the result. 
Result so far: 19.0
The remainder is 36 after subtracting 360 from 396.
Grab the next digit (6) from the dividend, add it to 36, then carry on: 366 / 40

Advancing to step 4:
40 can be fit into 366 9 times, resulting in a remainder of 6.
The next digit of our result is 9. 
Result so far: 199.0
Deduct 360 from 366 and we're left with 6.
Take the next digit (9) from the dividend and append it to 6, then repeat: 69 / 40

Going ahead to step 5:
The number 40 fits into 69 1 times, leaving a remainder of 29.
Use 1 as the next digit of our solution. 
Result so far: 1991.0
Subtracting 40 from 69 leaves us with 29.
Take the next digit (8) from the dividend and append it to 29, then repeat: 298 / 40

Moving on to step 6:
40 goes into 298 7 times with a remainder of 18.
Put 7 as the next digit of the answer. 
Result so far: 19917.0
If we take 280 away from 298, we end up with 18.
Since there are no more digits in the dividend, we add a zero to the remainder making it 180, and continue the process.

Advancing to step 7:
When dividing 180 by 40, we get 4 with a remainder of 20.
The next digit of our result is 4. 
Result so far: 19917.4
The remainder is 20 after subtracting 160 from 180.
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:
The number 40 fits into 200 5 times, leaving a remainder of 0.
Put 5 as the next digit of the answer. 
Result so far: 19917.45
Subtract 200 from 200 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.

Moving on 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: 19917.45
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.

Going ahead to step 10:
0 divided by 40 is 0 with a remainder of 0.
Use 0 as the next digit of our solution. 
Result so far: 19917.45
Deduct 0 from 0 and we're left 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.

The final result is 19917.45 with a remainder of 0.0.