Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Factorial
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.Write("Введите число: ");
- int number = int.Parse(Console.ReadLine());
- Factorial(number);
- string output = String.Format("Факториал вашего числа равен {0}", Factorial(number));
- Console.WriteLine(output);
- Console.ReadLine();
- }
- public static double Factorial(double i)
- {
- if (i == 0)
- {
- return 1;
- }
- else
- {
- double returnNumber = i * Factorial(i - 1);
- return returnNumber;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement