Advertisement
Guest User

Untitled

a guest
Dec 11th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp17
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13.  
  14. for (int i = 1; i <= 12; i++)
  15. {
  16. Console.WriteLine(i + " ... " + factorial(i));
  17. }
  18. Console.ReadLine();
  19. }
  20.  
  21. static int factorial(int number)
  22. {
  23.  
  24. int result = number;
  25. for (int i = number - 1; i >= 1; i--)
  26. {
  27. result = result * i;
  28. }
  29.  
  30. return result;
  31. }
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement