You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
719 B
18 lines
719 B
#include "calculatorFactorial.h"
|
|
// Note:
|
|
/* This Function may or may not be implemented in actual program, even if it is merged to the main branch.
|
|
If it is temporarily not included in the main Program, then this has a role in future Development of the Project */
|
|
|
|
|
|
int calculatorFactorial(int num) //implement recursion. The function calls itself so many times, till the breaking condition is fulfilled.
|
|
{
|
|
if (num == 0) //breaking condition
|
|
{
|
|
return 1;
|
|
}
|
|
else
|
|
{
|
|
return num * calculatorFactorial(num - 1); //If its not breaking condition, then multiply the number with the same function implemented on the previous number. Eventually it will reach breaking condition.
|
|
}
|
|
}
|
|
|