Skip to content

Instantly share code, notes, and snippets.

@philorocha
Created November 10, 2017 23:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philorocha/b2a0f4a3dcc714fbfb498a50c5d9a1b1 to your computer and use it in GitHub Desktop.
Save philorocha/b2a0f4a3dcc714fbfb498a50c5d9a1b1 to your computer and use it in GitHub Desktop.
Fatorial
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
int main()
{
int numero, fatorial = 1;
setlocale(LC_ALL, "Portuguese");
printf("Digite um número maior ou igual a 0: ");
scanf("%d", &numero);
for (; numero > 0; numero--) {
fatorial *= numero;
}
printf("O fatorial é %d\n", fatorial);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment