okay so i have a loop that calculates the fibonacci series based on the 2 inputs and i want it to only output the last number. so the person enters the position (say 5) and I dont want to show position 4, only 5. Not sure how to do this.
Also: I am not allowed to use IF statements
NEVER MIND - HERE IS THE RESULT
_________________________
#include <iostream>
using namespace std;
int main()
{
int num1, num2, num3;
int pos = 0;
cout<<"Enter the first value of the series.";
cin >> num1;
cout<<"Enter the second value of the series.";
cin >> num2;
cout<<"What position do you want to calculate?";
cin>> pos;
while (pos < 3 )
{
cout << "You must enter a position of at least 3!";
cout<<"What position do you want to calculate?";
cin>> pos;
}
for (int i = 3; i <= pos; i++)
{
num3 = num1 + num2;
num1 = num2;
num2 = num3;
}
cout << "The value in position " << pos << " is " << num3 << ".";