Horje
factorial n using class in c# Code Example
factorial n using class in c#
using System;
public class Program
{
	public int findFact(int n)
	{
		int i, f = 1;

		for (i = 1; i <= n; i++)
		{
			f = f * i;
		}
		return f;
	}

	public static void Main(string[] args)
	{
		int x, f;

		Console.Write("Enter a number:");
		x = Convert.ToInt32(Console.ReadLine());

		Program obj = new Program();
		f = obj.findFact(x);

		Console.WriteLine("Factorial is:" + f);
	}
}
Source: xiith.com




Csharp

Related
telerik raddatepicker default date today wpf Code Example telerik raddatepicker default date today wpf Code Example
Open API support for ASP.NET Core Minimal API Code Example Open API support for ASP.NET Core Minimal API Code Example
ExecuteResultAsync ActionContext statuscode Code Example ExecuteResultAsync ActionContext statuscode Code Example
c# allowedusernamecharacters Code Example c# allowedusernamecharacters Code Example
.net core executenonqueryasync transaction Code Example .net core executenonqueryasync transaction Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10