#include<iostream.h>
int main()
{
int n=-1;
int d=1; // diff
int limit;
cout<<"Enter limit upto which series is to be generated : ";
cin>>limit;
do
{
cout<<n<<" ";
n = n + d;
d = d + 2;
}while(n<=limit);
}
OUTPUT:-
Enter limit upto which series is to be generated : 25
-1 0 3 8 15 24