Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int FAT(int n)
- {
- int resultado;
- resultado = 1;
- while(n>0)
- {
- resultado = resultado*n;
- n--;
- }
- return resultado;
- }
- int main()
- {
- int N, fatorial, fatmais4;
- do
- {
- printf("Digite um numero: ");
- scanf("%d", &N);
- if(N<0)
- {
- printf("numero invalido!");
- }
- }
- }while(N<0);
- fatorial = FAT(N);
- fatmais4 = fatorial+4;
- printf("O fatorial eh: %d e o fatorial acrescido de 4 eh: %d", fatorial, fatmais4);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement