15)C PROGRAM TO FIND THE FACTORIAL OF A GIVEN NUMBER.
LOGIC:- Factorial is a mathematics topic.Where a number is multiply by its 1 less than number,and proceeds until it not multiplied by 1.So here we understand that we multiply number of times so loop is used.
Example:-It is similar like addition of natural number, but only difference is here, is in the for loop where decrement is used i.e for loop in descending order.
NOTE:"""IT IS ALSO DONE BY USING ASCENDING ORDER LOOP""" WHICH IS SHOWN BELOW:
LOGIC:- Factorial is a mathematics topic.Where a number is multiply by its 1 less than number,and proceeds until it not multiplied by 1.So here we understand that we multiply number of times so loop is used.
Example:-It is similar like addition of natural number, but only difference is here, is in the for loop where decrement is used i.e for loop in descending order.
NOTE:"""IT IS ALSO DONE BY USING ASCENDING ORDER LOOP""" WHICH IS SHOWN BELOW:
Comments
Post a Comment