C++ Program to Print Series 1 -4 7 -10 . . . . -40

Here you will get C++ program to print series 1 -4 7 -10 . . . . -40.

Program

#include<iostream>
 
using namespace std;
 
int main()
{
	int i,a=-1,b;
	for(i=1;i<=40;i+=3)
	{
		a*=-1;
		b=i;
		b*=a;
		cout<<b<<" ";
	}
	
	return 0;
}

Leave a Comment

error: Alert: Content is protected!!