How to calculate the series 2 15 41 80 132 197 275 366 470 ... N in C

1 Answer

0 votes
#include <stdio.h>
 
int main(void) {
    int a = 2, total = 9;
     
    for (int i = 1; i <= total; i++) {
        printf("%d ", a);
        a += 13 * i;
    }
     
    return 0;
}
 
 
 
 
/*
run:
 
2 15 41 80 132 197 275 366 470 
 
*/

 



answered Apr 2, 2022 by avibootz
edited Apr 3, 2022 by avibootz
...