C++ Program to Print following series: 1 -4 7 -10……….-40

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,a=-1,b;
for(i=1;i<=40;i+=3)
{
     a*=-1;
     b=i;
     b*=a;
     cout<<b<<” “;
}
getch();
}

3 thoughts on “C++ Program to Print following series: 1 -4 7 -10……….-40

Leave a Reply

Your email address will not be published. Required fields are marked *