Contact Learn C
Copy

Program 343 : Generate Series -1,4,-7,10,-13....till N

Program 343 : Generate Series -1,4,-7,10,-13....till N
 
#include<stdio.h>
main()
{
 int i,j=1,terms;
 printf("Enter number of terms\n");
 scanf("%d",&terms);
 for(i=1;i<=terms;i++)
 {
  if(i%2==1)
  printf("%d ",(-1*j));
  else
  printf("%d ",j);
  j+=3;
 }
 printf("\n");
}
Explanation:
//Coming Soon

Output: 

Generate Series -1,4,-7,10,-13....till N





 
Donate

Download App and Learn when ever you want

Get it on PlayStore
Get it on Amazon App Store
Get it on Aptoide