bsc

Comprehensive codebase and cou...
Log | Files | Refs | README | LICENSE

P052.c (716B)


      1 /*
      2  * Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 12 Dec 2025
      3  * Repo: https://github.com/notamitgamer/bsc
      4  * License: MIT
      5  */
      6 
      7 /* Print the sum of this series for upto n element.
      8     Series: 1 + (1 + 2) + (1 + 2 + 3) + (1 + 2 + 3 + 4) + ... + (1 + 2 + 3 + ... + n) */
      9 
     10 // This code has not been compiled.
     11 // If you find any issues, please create a new issue on GitHub regarding them.
     12 // Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues
     13 
     14 #include <stdio.h>
     15 
     16 int main()
     17 {
     18     int n, sum = 0, temp = 0, i;
     19     printf("Enter the n : ");
     20     scanf("%d", &n);
     21     for (i = 1; i <= n; i++)
     22     {
     23         temp += i;
     24         sum += temp;
     25     }
     26     printf("%d", sum);
     27     return 0;
     28 }
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror