Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- It calculates the sum of the first n terms of a series with factorials in its denominator.
- */
- #include <stdio.h>
- int main(){
- int n, w = 1, k = 1;
- float e = 1;
- printf("Enter n: ");
- scanf("%d", &n);
- while(k <= n){
- w = w*k;
- e = e + 1.0/(w);
- k = k + 1;
- }
- printf("%f\n", e);
- }
Advertisement
Add Comment
Please, Sign In to add comment