Advertisement
guidecastro

Questão 3

Sep 19th, 2014
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.18 KB | None | 0 0
  1. static int fatorial (int n)
  2. {
  3.  
  4. if (n < 0)
  5.  
  6. Console.WriteLine("Não existe fatorial de número negativo!");
  7.  
  8. else
  9.     if (n<2)
  10.         return 1;
  11.  
  12.         else
  13.             return n*fatorial(n-1);
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement