The algorithm for calculating the value of the functions F(n)
and G(n)
, where n
– non-negative integer, is given by the following relations:
F(n) = n % 10
if n < 100
;
F(n) = n / 100 + G(n%100)
, otherwise;
G(n) = n % 10
if n < 100
;
G(n) = n % 100 + F(n/100)
, otherwise;
Determine the sum of all function values G(n),
for all values n
smaller 100000?
The sign /
- means integer division operation.
The sign %
- means the operation of calculating the remainder when dividing two integers.