Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- main()
- {
- int NUM, ACM = 1;
- printf("Digite o numero que vai ser calculado o fatorial: \n");
- scanf("%d", &NUM);
- while(NUM>0) // laço de repetição; enquando a variavel for maior que 0 ele vai executar o laço
- {
- ACM = ACM*NUM;
- NUM--; // condição para ir subtraindo o numero
- }
- printf("\n\n\nO resultado do fatorial sera: %d \n\n\n", ACM);
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement