Program # 5 : Factorial using Function :
#include <iostream>using namespace std;int factFinder(int x){if(x==0){return 1;}else{return x*factFinder(x-1);}}int main(){cout << factFinder(5) << endl;}
Note : You can use any integer number in the code. I just use 5 .
0 comments:
Post a Comment