0
Fibonot checking doesn't work.Why?
Check the cod.Why doesn't the code give any output? https://code.sololearn.com/cdw079UX5PtS
6 Answers
+ 1
KAZI FAISAL MAHMUD
1 - you are taking single input but according to example you should take multiple inputs
2 - how this loop will work when n1 = 1 and n2 = 1
for(i = n1 + 1; i < n2; i++) {
+ 1
KAZI FAISAL MAHMUD OK. Moving forward!
Why will you need to use break in the for loop? You have a known number of iterations.
0
AĶ¢J Check now.Is it okay?
0
KAZI FAISAL MAHMUD Before anything else: the Code Playground runner gives errors and warnings. Pls fix them first, then start concerning the calculations.
That said: you declare an array, but only ever use its last item. Why not just declare it as a single int?
Also, the while loop has two exit points - break and while - which are redundant. Moreover, you know the number of iterations beforehand. How about a simpler for loop?
Another hint: practice better code readability. Use consistent indentation and meaningful variable names. This makes it understandable to other people - including who wants to help you.
0
Emerson Prado Thank you.I will try to obey your advices further.
Anyway, 'Break' is the exit point of forloop.
This problem is to find K'th fibonot(Non-fibonacci number).
0
Suppose, K=7.Then FN[K]==K[7].
But my loop condition is made with n2.So there is a. Chance to overflow of this array.