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
What precautions we need to take while deploying satellite assemblies? When we distribute the assembly, the folder structure has to be very organized. The table below shows how


Describe all elements in Static Chart diagrams. Package: - The Package logically groups element of a UML model. Class: - The Class describes all set of objects with

How can you use Hidden frames to cache client data? This technique is implemented by developing a Hidden frame in page which will have your data to be cached. T cols="100

How do I write common code for different dot net framework data providers?

Develop Outlook Add-In for all versions I need simple code for Outlook(express,2003,2007,2010,2013) Add-In with functionality to repeatedly send CC to the specified email(s), th

Project Description: Overview: Prepare Windows program that runs in the background and on start up on the client's computer that grabs CERTAIN data from a.SDF file (SQL Serve

What is the difference between System exceptions and Application exceptions? All exception is derived from Exception Base class. Exceptions are generated programmatically or ca

Can you give an example of what might be best suited to place in the application_Start and Session_Start subroutines? Application Start - We can place code to initialize

i want to know how can i sum quantity column in gridview and place it in first row...not in footer..in .net. Rply ASAP