Does the following recurrence relation = 50, am I doing this right?
Code:S(1)=5; S(N)=S(N-1) + 5 for N>1
Printable View
Does the following recurrence relation = 50, am I doing this right?
Code:S(1)=5; S(N)=S(N-1) + 5 for N>1
A recurrence relation itself doesn't equal some number...
ggCode:#include <iostream>
using namespace std;
int S(int n)
{
if (n == 1)
return 5;
return S(n - 1) + 5;
}//S
int main()
{
for (int n = 1; n <= 10; n++)
cout << "S(" << n << ") = " << S(n) << endl;
return 0;
}//main