0

how to fix

hi I am making the code for factorial but output is not true ! how to fix it int main() { int x; cout<<"vared konid"; cin>>x; fact(x); return 0; } int fact(int n) { int r,s,fac=1; while(n!=0) { s=1; r=n%10; cout<<r<<"*"; s*=r; n/=r; } cout<<"="<<s; return 0; }

4th Aug 2018, 10:45 AM
amir ht
amir ht - avatar
1 ответ
+ 1
There is no recursion in your example. Try this. https://code.sololearn.com/c4EaDDxKmr8K/?ref=app
4th Aug 2018, 11:01 AM
Steppenwolf
Steppenwolf - avatar