fork(7) download
  1. using System;
  2. namespace test
  3. {
  4. class Program
  5. {
  6. static void Main(string[] args)
  7. {
  8. Console.Write("Введите число для вычисления суммы факториала = ");
  9. int num = Convert.ToInt32(Console.ReadLine());
  10. double sum = 1;
  11. double currentNumber = 1;
  12.  
  13. for(int i=2; i<=num; i++) {
  14. currentNumber *= i;
  15. sum += currentNumber;
  16. }
  17. Console.WriteLine("sum=" + sum);
  18. Console.ReadLine();
  19. }
  20. }
  21. }
Success #stdin #stdout 0.03s 37016KB
stdin
3
stdout
??????? ????? ??? ?????????? ????? ?????????? = sum=9