Ticker

6/recent/ticker-posts

Header Ads Widget

Find the factorial of a number

What is the factorial of the number 'n'?
The numerical base 'n' is the product of every number from 1 to the value 'n-1'
is shown n !. For example n = 5 then the factorial of 5 will be 1 * 2 * 3 * 4 * 5 = 120. 5! = 120
Factorial C ++ Logic program:
What is the factorial of the number 'n'?
The numerical base 'n' is the product of every number from 1 to the value 'n'
is shown n !. For example n = 5 then the factorial of 5 will be 1 * 2 * 3 * 4 * 5 = 120. 5! = 120
Factorial C ++ Logic program:
First guess what is a number line? How can it be calculated mathematically.
Once you get this information it will be very easy to create a C ++ Program to find the truth.
The user enter the number and we have to multiply all the numbers that have arrived.
Such that when a user enters 6 it should be Factorial equal to factorial = 1 * 2 * 3 * 4 * 5 * 6.
In this case the Loop will be very helpful. It will start from the same one and multiply all the numbers that have reached it after it is disconnected.
Take the variable and initialize it to 1 and in the result of the duplicate store the same is entered in the program below the variable
Factorial is used for this purpose .What did we not set to 1 and set it to be zero or continue unauthorized. If 0 our results will be zero if any number is entered
If we do not start our startup our answer will be very correct but if the variable contains the amount of waste then we will not get the right result.
It is recommended that you start it early.



Find the factorial of a number

Q) Find the factorial of a number ?
Sol)


#include<iostream.h>
#include<stdlib.h>
int main()
{
system("cls");
int i,num,fact=1;
cout<<"\n enter integer :";
cin>>num;
i=num;
while(num)
{
fact*=num;
--num;
}
cout<<"the factorial of"<<i<<"is"<<fact<<"\n";
return 0;
}





Other related post:-

Shutdown someone pc using notepad trick
Let window speak to you
Create quiz game using notepad
Program to check planidrome
Find factorial using program
Program to check leap year
Program to sort an array
Program to multiply two matrixes
Program to find root of quadratic equations
Array coding interview questions
Program creating basic calculator
Program to convert Fahrenheit to Celsius or Celsius to Fahrenheit
Program to implement distance formula


Top featured feeds
Top pattern problems
Array coding interview questions

Post a Comment

0 Comments