Advertisement
luizaspan

Fatorial de um número (PROBLEMA)

May 12th, 2015
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. // calcular o fatorial de um número inteiro n
  2.  
  3. #include <stdio.h>
  4.  
  5. int main(void)
  6. {
  7.  
  8.   int n,i,f;
  9.   printf("\nn= ");
  10.   scanf("%d",&n);
  11.  
  12.   f=1;
  13.  
  14.   for (i=n;i>=1;i=i-1)
  15.     {
  16.       f*=i;
  17.     }
  18.  
  19.   printf("\nO fatorial de %d é %d\n\n.",n,f);
  20.      
  21.  
  22.   return 0;
  23.  
  24. }
  25.  
  26.  
  27. // a partir de 12! não dá mais certo, por que?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement