Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int number = int.Parse(Console.ReadLine());
- List<int> numbers = new List<int>();
- int factorial = 1;
- for (int i = 1; i <= number; i++)
- {
- numbers.Add(i);
- }
- for (int i = 0; i < numbers.Count; i++)
- {
- factorial = factorial * numbers[i];
- }
- Console.WriteLine(factorial);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment