victorialais

Questão 8. Calcular fatorial

Aug 19th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.28 KB | None | 0 0
  1.  
  2. #include <stdio.h>
  3.  
  4. int main()
  5. {
  6. int fatorial, numero;
  7. printf("Digite um número e te daremos o seu fatorial ");
  8. scanf("%d", &numero);
  9.  
  10. for(fatorial = 1; numero > 1; numero = numero - 1)
  11. fatorial = fatorial * numero;
  12.  
  13. printf("\nFatorial: %d", fatorial);
  14. return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment