Basically my professor coded it another way but mine works too. I just wanted to ask is there any hidden problems in my code that I don't understand? If it's basically the same (which I'm assuming it is), I'll just do it my way.
MY CODE
int current=0, next =1, temp;
for(int i=0;i<number;i++){
temp = current;
current = next;
next +=temp;
}
return current;
}
PROFESSOR CODE
int current=0, next =1, temp;
for(int i=0;i<number;++i){
temp = next+current;
current = next;
next =temp;
}
return current;
}