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
Small website using ASP.NET MVC 4 EntityFramework 5 Project Description: We are seeking a developer to a ASP.NET MVC4 EntityFramework website using the subsequent tools: Visu

This assignment document will be distributed from Blackboard assignment folder. Some parts of the assignments will require you to research answers from your text book (you must rea

What is the Append Format for FileUpload Control in ASP.Net? What it specify?

How does output caching work in ASP.NET?    Output caching is a powerful method that enhances request/response throughput by caching the content generated from dynamic pages. O

Design an interface and add code to command buttons using case statement, to find coursework to be calculated using formula 0.6*1/6*total Mark

Project Description: customise samba pos. Just remove samba pos logo and rebrand it. The title in the frame needs to be changed as well as the splash screen at the beginning.

What is SQl injection? This is a Form of attack on the  database-driven Web site in which the attacker executes the unauthorized SQL commands by taking merits of insecure code

What is the use of data adapter? The Data adapter are the objects that connect one or more Command objects to a Dataset object. They give logic that would get data from the dat

Calculating the Sum of Digits - C# Program Hi, Can any of you, tell me how can i calculate the sum of digits of a given number?

Explain the elements of a collaboration diagram. Classifier Role: - It only classifies a role. Association Role: - It shows the relation b/w two classifier roles.