Sum of Series||C language||programming_info ||Series problem 11

To calculate sum of the first N terms of the series:
0.6,0.06,0.006,0.0006...

Solution using C language:

#include <stdio.h>
#include <math.h>
int main() {
   int n ;
   printf("Enter the range\n");
   scanf("%d",&n);
   float sum = 2*((1 - 1 / pow(10, n)))/3;
   printf("sum = %f", sum);
}

Output:
Enter the range
6
sum=0.666666
Share:

No comments:

Post a Comment

Translate

Recommended platforms

  1. codechef
  2. hackerrank
  3. codeforces
  4. leetcode
  5. hackerearth

Popular Posts

programming_info. Powered by Blogger.

Blog Archive

Recent Posts

other platforms

  • geeks for geeks
  • w3schools
  • codepen
  • skillshare
  • udemy

Pages

reader support Support