VPanev

Untitled

Dec 5th, 2021
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5. namespace ConsoleApp1
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. int number = int.Parse(Console.ReadLine());
  12.  
  13. List<int> numbers = new List<int>();
  14. int factorial = 1;
  15.  
  16. for (int i = 1; i <= number; i++)
  17. {
  18. numbers.Add(i);
  19. }
  20.  
  21. for (int i = 0; i < numbers.Count; i++)
  22. {
  23. factorial = factorial * numbers[i];
  24. }
  25. Console.WriteLine(factorial);
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment