已知2的n次方的值,如何求n?
已知2的n次方的值,如何求n?
#include<stdio.h>
void main()
{
int n=0;
long sum,s;
scanf("%ld",&s);
sum=s;
while(s>1)
{
s=s/2;
n++;
}
printf("%ld=2的%d次方",sum,n);
}