My c++ practice code;

 #include <iostream>

#include<cmath>
int fact(int N)
{
    int res = 1;

    for(int i=2; i<=N; i++)
    {
        res = res * i;
    }
    int res1 = res;
    std::cout<<res1<<std::endl;
    int res2 = 0;
    while (res1>0)
    {
        res1 = res1 / 10;
        res2++;
    }
    return res2;
}
int main()
{
    std::cout<<fact(151);
   
    return 0;
}

Post a Comment

0 Comments