小猴在一天内摘了94个桃子,当天吃掉一半多一个,以后每天都吃尚存一半多一个,问小猴直到第几天早上要吃时只剩下一个了? c语言写
/* Note:Your choice is C IDE */
#include "stdio.h"
void main()
{
/*
小猴在一天内摘了94个桃子,当天吃掉一半多一个,以后每天都吃尚存一半多一个,问小猴直到第几天早上要吃时只剩下一个了? c语言写
*/
int total = 94;
int day = 0;
while(total>0){
total = total/2-1;
day++;
}
printf("day=%d",day);
}
#include <stdio.h>
void main()
{
int total = 94;
int day = 1;
while(total>1)
{
total = total/2-1;
day++;
}
printf("day=%d",day);
}