ramontricolor12

LISTA 03 - exercício 10

Jun 11th, 2013
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     int n, i, j, fat;
  6.     float s;
  7.  
  8.     printf("Informe um valor: ");
  9.     scanf("%d", &n);
  10.     s = 1;
  11.     for(i = 1; i <= n; i++)
  12.     {
  13.         for(j = i, fat = i; j > 1; j--)
  14.         {
  15.             fat *= (j-1);
  16.         }
  17.         s += (1.0 / fat);
  18.     }
  19.  
  20.     printf("\nO valor da sequencia e = %f\n", s);
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment