#include<stdio.h>
#include<math.h>
int loga(int r,int b);
int main(void)
{
int r,b,l;
printf("What's the base?\n");
scanf("%d",&b);
printf("What's the real number?\n");
scanf("%d",&r);
l=loga(r,b);
printf("The logarithn is %d.\n",l);
return 0;
}
int loga(int r,int b)
{
int s=0,i;
for(i=0;s!=r;i++)
s=pow(b,i);
return --i;
}
求任意底数和任意真数的对数
最新推荐文章于 2021-09-08 19:43:04 发布