取对数(整数,不精确)

#include <stdio.h>
int main()
{
    long int t,x,y,ret=0;
    printf("底和真数: ");
    scanf("%d%d",&x,&y);
    t=y;
    while(y>x)
    {
        y/=x;
        ret++;
    }
    printf("log %d of %d is  %d",x,t,ret);
    return 0;
}

原文地址:https://www.cnblogs.com/xderbyy/p/9481663.html