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
No comments:
Post a Comment