I'm working through a course from Coursera. I am trying to find a solution for their infinite while loop question with an unknown variable.
The Problem Is:
int i = 1;
while (<<?>>) {
i = i*n;
}
What should be written in place of <<?>> so that the loop ends when i is at least 34? You may assume n is an int variable that has been declared and given a value prior to this code (the value of n does not affect the answer to this question).
I tried for the condition, i % 34 = 0
, i<=34
, etc. but I couldn't find the right answer. And they aren't giving the solution for this problem.
How can I solve this problem without knowing n's value?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…