using namespace std;
const int MAX = 9;
int main()
{
int list[MAX];
list[0] = 1;
list[1] = 2;
for (int i = 2; i < MAX; i++)
{
list[i] = list[i-1] * list[i-2];
if (i > 5)
{
list[i] = list[i] - list[i-1];
}
}
for (int i = 0; i < MAX; i=i+1)
{
cout << list[i] << " ";
}
cout << endl;
return 0;
}
#include<iostream>
using namespace std;
const int MAX = 9;
int main()
{
int list[MAX];
list[0] = 1;
list[1] = 2;
for (int i = 2; i < MAX; i++)
{
list[i] = list[i-1] * list[i-2];
if (i > 5)
{
list[i] = list[i] - list[i-1];
}
}
for (int i = 0; i < MAX; i=i+1)
{
cout << list[i] << " ";
}
cout << endl;
return 0;
}
Exact output:-
1 2 2 4 8 32 224 6944 1548512
Get Answers For Free
Most questions answered within 1 hours.