factorial using recursion style in c++ is
unsigned int fact(unsigned int a)
{
if (a<=1)
return 1;
else
{
f*=fact(a-1);
return a;
}
}
when using looping structure factorial is
unsigned int fact (unsigned int n)
{
unsigned int i,f=1;
for(i=1;i<=n;i++)
f*=i ;
return f;
}
Copyright © 2026 eLLeNow.com All Rights Reserved.