Here you will get a C++ program to print series 1 -4 7 -10 . . . . -40.
#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;
}
Output:
1 -4 7 -10 13 -16 19 -22 25 -28 31 -34 37 -40
For any queries related to the above code ask in the comment section below.
thankyou
Hey thanks
1,2,4,7,10,……40 solve it plzz c++ way
Thank you. Its helped me complete a class assignment.
Hii sir, i have a doubt here can u plzz explain how this program print -4, and -10
Can you pls give its python program also
I want
Bluej programming
a program that inputs series of integers and passes them one at a time to a function even which uses the modulus operator (%) to determine if an integer is even. The function should take an integer argument and return 1 if the integer is even and 0 otherwise.