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

CWC
0 Min Read

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

#include
#include
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;
}
Share This Article
Leave a comment

Leave a Reply

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

English
Exit mobile version