Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* CABEÇALHO
- Arquivo: LISTA 03 - Exercicio 9(usando while).c
- Objetivo: Fatorial de um número com o comando while.
- Autor(a): Ramon Borges
- */
- #include <stdio.h>
- int main()
- {
- int numero, fatorial;
- printf("\nInforme um numero: ");
- scanf("%d", &numero);
- if(numero < 0)
- printf("\nValor indeterminado.");
- else
- {
- fatorial = 1;
- while(numero > 1)
- {
- fatorial *= numero;
- numero--;
- }
- }
- printf("Fatorial = %d", fatorial);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment