bsc

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

P036.c (452B)


      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 /* sum = a + (a^2)/2 + (a^3)/3 + ... + (a^n)/n */
      8 
      9 #include <stdio.h>
     10 #include <math.h>
     11 
     12 int main()
     13 {
     14     double a, sum = 0;
     15     int n, i;
     16     printf("Enter value for a and n : ");
     17     scanf("%lf %d", &a, &n);
     18     for (i = 1; i <= n; i++)
     19         sum += pow(a, i) / i;
     20     printf("\nSum = %g", sum);
     21     return 0;
     22 }
© 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