bsc

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

root / semester_1 / tuition-c / P052.c

P052.c (580B)


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