I have written a program for the moosonocci sequence, but after the 37th value it starts producing negative numbers. I don't know why it is doing this, any suggestions?
#include <iostream>
using namespace std;
void moosonocci( int size)
{
int myseries [ size ];
myseries[0] =1;
myseries[1]=1;
myseries[2]=1;
If a signed integral value gets too high, it will wrap back to the negative values, if you use unsignedlong instead of int
( or unsignedlonglong if your compiler supports it ) you can have a bit higher values