Series |C language||programming_info ||Series problem 15

Print the series upto N terms
2,15,41,80,132,197,275...

Solution using C language:

#include<stdio.h>
int main()
{
    int a=2,i,n;
     printf("Enter the range:\n");
     scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        printf("%d  ",a);
        a+=13*i;
    }
    return 0;

}

Output:
Enter the range:

6
2 15 41 80 132 197
Share:

No comments:

Post a Comment

Translate

Recommended platforms

  1. codechef
  2. hackerrank
  3. codeforces
  4. leetcode
  5. hackerearth

Popular Posts

programming_info. Powered by Blogger.

Blog Archive

Recent Posts

other platforms

  • geeks for geeks
  • w3schools
  • codepen
  • skillshare
  • udemy

Pages

reader support Support