SHARE
TWEET

ex07lista05

mahatma_xande Aug 22nd, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. It calculates the sum of the first n terms of a series with factorials in its denominator.
  3. */
  4.  
  5. #include <stdio.h>
  6.  
  7. int main(){
  8.  
  9.     int n, w = 1, k = 1;
  10.     float e = 1;
  11.  
  12.     printf("Enter n: ");
  13.     scanf("%d", &n);
  14.  
  15.     while(k <= n){
  16.         w = w*k;
  17.         e = e + 1.0/(w);
  18.         k = k + 1;
  19.     }
  20.  
  21.     printf("%f\n", e);
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top