Răspuns :
f(4770777,7) = 3
numara cate cifre de 7 exista la coada pana da de o cifra diferita de 7, atunci se opreste
Răspuns:
f(4770777, 7) = 3
[tex]\\[/tex]
Explicație pas cu pas:
f = f(4770777, 7)
[tex]\\[/tex]
4770777 != 0:
4770777 % 10 == 7:
[tex]f = 1 + f(477077, 7)[/tex]
[tex]\\[/tex]
477077 != 0:
477077 % 10 == 7:
[tex]f = 1 + \big(1 + f(47707, 7)\big)[/tex]
[tex]\\[/tex]
47707 != 0:
47707 % 10 == 7:
[tex]f = 1 + \Big(1 + \big(1 + f(4770, 7)\big)\Big)[/tex]
[tex]\\[/tex]
4770 != 0:
4770 % 10 != 7:
[tex]f = 1 + \big(1 + (1 + 0)\big)[/tex]
[tex]f = 3[/tex]