How often will occur * ?
void Star(int n) {
for (i=0;i<n;i++) {
printf("*");
Star(i);
}
}
I thing so , but I don`t know how I can count it.
You are right about the number of *. Let's call the number of * printed by a call to Star(n) by . The program gives rise to the recurrence relation on :
.
After you have a recurrence relation, you can calculate the first several values and make a hypothesis about the general formula, but you have already done this. Then you need to prove this hypothesis, i.e., for all n, by induction on n using the recurrence relation.