C++ Exercises
C++ Exercises
#include <iostream>
int main() {
pre1 = pre2;
pre2 = curr;
counter++;
return 0;
#include <iostream>
int main() {
pre1 = pre2;
pre2 = curr;
counter++;
cout<<curr<<" ";
}
return 0;
III – The following program prompts the user for 1st two values and the position of the nth Fibonacci
number. It then generate the nth Fibonacci value:
#include <iostream>
int main() {
cin>>pre1>>pre2>>n;
i = n - 2;
pre1 = pre2;
pre2 = curr;
counter++;
return 0;