Hi
i have been asked to write a program to generate fibonacci as well as non fibonacci numbers till a certain value. i have just started learning c++. i managed to find the fibonacci series but i am unable to find the non fibo one. how do i go about with?? pls can anyone help me!
my code:
int fibonacci( int i )
{
int final[] = { 0, 1 };
while ( i > 1 )
{
int f = final[0];
final[0] = final[1];
final[1] = final[0] + f;
--i;
}
return final;
}
void main()
{
for ( int i = 0; i < 10; ++i )
cout << i << ": " << fibonacci( i ) << '\n';
}