#include<stdio.h>
#include<stdlib.h>
int main(void){
int a,b,n;
scanf("%d%d",&a,&b);
while(x>=y){
x/=y;
n++;
}
printf("logy x == %d \n",n); // y的n次方等於x
}
-------------------------------------------------------------------
do while 寫法 差不多 格式不太一樣
int main(){
int x,y,n=0;
scanf("%d%d",&x,&y);
do{
x/=y;
n++;
}
while(x>=y);
printf("%d",n);
}
全站熱搜
留言列表