Showing posts with label factorial solver in c#. Show all posts
Showing posts with label factorial solver in c#. Show all posts

Sunday, December 11, 2016

Factorial Solver in C#

To all my visitors and followers of my website thank you for visiting even though I'm not earning any money here but still I want to spread the message to share the knowledge in computer programming to all. Anyway in this article I would like to share with you a sample program that I used using C# to accept a number from our user and then our program will compute the factorial equivalent of the given number by our user. The code is very short and easy to understand.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.




Sample Program Output


Program Listing

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace factorial
{
    class factorial
       { 
           /* Program : Factorial Solver                       */
           /* Author  : Mr. Jake R. Pomperada, MAED-IT         */
           /* Date    : Noverber 26, 2016  Saturday  10:59  AM  */
           /* Tools   : C#                                     */

        static void Main(string[] args)
        {
            int num=0, a=0, fact = 1;
            Console.Write("\n\n");
            Console.Write("  ===== FACTORIAL SOLVER ===== ");
            Console.Write("\n\n");
            Console.Write("Give a Number : ");
            num = int.Parse(Console.ReadLine());
            for (a= num; a >= 2; a--){
                fact *= a;
            }
            Console.Write("\n\n");
            Console.Write("The Factorial Values of {0} is {1}.", num, fact);
            Console.Write("\n\n");
            Console.Write("  End of Program ");
            Console.Write("\n\n");
            Console.ReadLine();
        }
    }
}