bsc

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

root / semester_1 / tuition-c / P036.c

P036.c (316B)


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