/*Input a postive integer n and check if it is a factorial of some *integer m or not. If yes, print m, otherwise, print "NO". *author:rahule@cse.iitk.ac.in */ #include int main() { double m,n,fact=1,i; printf("\nenter n and m :"); //enter n , m scanf("%lf%lf",&n,&m); for(i=1;i<=m;i++) //finding the factorial of m in "fact" fact=fact*i; if(fact==n) //checkiing if factorial is equal to n printf("\nthe factorial is %lf",n); else printf("\nNO"); printf("\n"); }