求 log2x

#include<stdio.h>  
#include<math.h>  
int main(void)  
{  
   int x;
   int ret=0;
   scanf("%d",&x);
   int t=x;
   while(x>1)
   {
       x=x/2;
       ret++;
   } 
   printf("log2 of %d is %d",t,ret);
    return 0;  
}  
原文地址:https://www.cnblogs.com/2228212230qq/p/7989021.html