LOOP STATEMENT + IF ELSE PROGRAMME TO PRINT SERIES -1,4,-7,10,-13........

#include<iostream.h>
#include<conio.h>

void main()
{
clrscr();
int n;
cout<<"enter any number to print series till that";
cin>>n;
for (int i=1; i<=n; i+=3)
{
if(i%2==0)
{
cout<<"\n"<<i;
}
else
{
cout<<"\n"<<i*-1;
}
}
getch();
}

Comments

Popular Posts