This is my code to find factorial inverse
double num;
cin>>num;
double i=1,fact=1;
for(i=1;i>0;++i)
{
fact*=i;
if(fact==num)
{
cout<<i;
break;
}}
But when i put the factorial of 28 the loop became infinite. When i output fact to check the loop, the answer was output among other factorial numbers but the loop kept going after the right factorial of 28. It works up to 27! .