An official Batch Programming blog! To Solve the daily problems with windows and fixing them with little notepad scripts. Unlock the Hidden Secrets of Windows, Learn to crack Software via CMD & Make your own Programming tools. Understand to Manipulate your PC via CMD.

Find Factorial of Number With Notepad | By Kvc

Finding the factorial of a number is not so much a difficult task to do, but it becomes very difficult when you have to make a computer understand that ‘You need it for calculating a Factorial‘. Defining in a programming language what a factorial is and using it for making your life easier seems to be a very difficult task.

You can make a program that can calculate a Factorial for you. Many of you already know the syntax or way to calculate Factorial with pen and paper. This is the same method we have to implement in the program.

Print Factorial of a Number | By Kvc

FIND FACTORIAL OF NUMBER WITH NOTEPAD

The logic to find a factorial of a number is very easy. As factorial is the simple multiplication of numbers, So it doesn’t matter whether you multiply them in increasing order or in decreasing order – the result remains the same. (I’m using simply a For loop here), which goes to the specified number and multiply all numbers coming in-between.

Fact(5) = 5 x 4 x 3 x 2 x 1 = 120 (Traditional Method)
Fact(5) = 1 x 2 x 3 x 4 x 5 = 120 (Same Result)

How does it work? – PRINT FACTORIAL OF A NUMBER

You can print the Factorial of any number you want to know, but as CMD has its own limitations – and there is the limit of an integer variable in CMD. (which holds the value of result calculated) As in the above image, we have simply printed the factorial of ‘5’ on the cmd console.

Limit of ‘n’ is 31

So, we can only print factorial of the first 31 natural numbers!! This is only due to the limitation of CMD variable length. But, we can still make it improved by using various techniques to boost the limit of variables. But, we can leave that for the next version maybe.

Also Read:  Keylogger in Batch 1.0 by Kvc | keylogger script using cmd

From Editor’s Desk

You can download this program, via the link given below. And, Share your opinion about the simple but informative project in the comments section below. I will be waiting for your comments and appreciations. You can also submit your own work – to share it with all other programmers worldwide.

HASH Code - For Verification - (SHA-256)
4e27ee778757efccea1009a29400c6ade4fedc82d63a6e7eba42cae2154cbe03

Keep learning, keep sharing….
Be happy, spread happiness…

TheBATeam

Download Link

Next Post

Previous Post

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© 2020 TheBATeam

Our Core Values   /   Terms & Conditions   /   Privacy Policy   /   Why Register?

Theme by Anders Norén