5,12,23,38,......
Solution using C language:
#include <stdio.h>
int main() {
int n ;
printf("Enter the range\n");
scanf("%d",&n);
int sum = (2*(n*(n+1)(2*n+1)/6)+(n(n+1)/2)+(2*n));
printf("the sum of series till %d is %d", n,sum);
return 0;
}
Output:
Enter the range
6
the sum of series till 6 is 215
No comments:
Post a Comment