Find out the factorial - c# program, DOT NET Programming

Find out the Factorial - C# Program

I've been trying so many codes for this but those codes didn't work well. Please write the code for find out the factorial of an integer number in C#.

Posted Date: 2/11/2013 11:49:04 PM | Location : United States





Try this code, it will help you.

Program of Finding Factorial

using System;  

class Factorial

{

  public static void Main()

 {

   int no,i,fact=1;

  Console.Write("Enter a number to find its factorial : ");

  no = int.Parse(Console.ReadLine());   

   if (no != 0)

  {

    for (i = no; i>=1; i--)

   {

    fact = fact * i;    

   }

   Console.WriteLine("Factorial = " +fact);

  }

   else

  {

   Console.WriteLine("You entered 0, not valid.");

  }  

  Console.ReadLine();

 }

}

Posted by Jermy | Posted Date: 2/11/2013 11:50:30 PM

Thank you for this code i really works well, you are doing great job.

Posted by Stephen | Posted Date: 2/11/2013 11:51:03 PM


Related Discussions:- Find out the factorial - c# program, Assignment Help, Ask Question on Find out the factorial - c# program, Get Answer, Expert's Help, Find out the factorial - c# program Discussions

Write discussion on Find out the factorial - c# program
Your posts are moderated
Related Questions
Project Description: I have a site that's previously fully developed, and need to fix some small problems (Text editor posting error, and a Server error caused by some Nhibernat

Printing and adding Fibonacci series - C# Program Hello guys i need your advice. How can i print and add Fibonacci series in my project. Please recommend some examples.

The ASP.NET provides two namespaces. The first is System.WEB.mailmessage class and the second is System.Web.Mail.Smtpmail class.

Question: (a) Using the help of a diagram, describe the layer of the .NET framework that sits between Visual Basic.NET 2005 and the operating system. (b) Explain the charac

Web Developer Project Description: We are in need of an expert web developer for long term connection; please apply with samples if you have the subsequent skills: ASP.NET


What are different transaction levels in SQL SERVER? The Transaction Isolation level decides how is the one process isolated from theother process. Using the transaction levels

What is Delegation? A delegate seems like a strongly type function pointer. Delegates can request the methods that they reference without making explicit calls to those methods

hello,i want to ask that i have to make a test taker just like a quiz in vb.net which should b like mcq''z one...it must contain a connectivity with database of oracle or MS access

I need .net expert help for Advance Project First let me start by saying that I have been writing code for almost 25 years. Therefore I am only looking for someone to aid advanc