Advertisement
webmanix

Prova joao

Dec 12th, 2012
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <conio.h>
  3.  
  4. int fatorial(int x)
  5. {
  6.     int y,a = x;
  7.     for(y = 1; y<x; y++)
  8.         a*=y;
  9.     return y;
  10. }
  11.  
  12. float neperiano(int x)
  13. {
  14.     int y;
  15.     float buf = 0;
  16.     for(y=1; y<=x; y++)
  17.         buf+=1/fatorial(y);
  18.     return buf;
  19. }
  20.  
  21. int main()
  22. {
  23.     int x,k;
  24.     float resultado;
  25.     printf("Digite o numero ");
  26.     scanf("%d",&x);
  27.     printf("%f\n",neperiano(x));
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement