fork download
  1. /*
  2. Generate the following series
  3. 3 6 11 18 27 38 51
  4. */
  5. #include <stdio.h>
  6.  
  7. int main() {
  8. int n = 7, term = 3;
  9.  
  10. for (int i = 1; i <= n; i++) {
  11.  
  12. printf("%d",term);
  13. term += (i + 2);
  14.  
  15. }
  16. printf("\n");
  17.  
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0s 5280KB
stdin
Standard input is empty
stdout
361015212836