完成猴子吃桃的问题.猴子第一天摘下若干个桃子,当即吃了一半,还不过瘾,又多吃了一个.第二天早上又将剩下的桃子吃掉一半,又

1个回答

  • #include "stdio.h"

    #include "conio.h"

    main()

    {

    int day,x1,x2;

    day=9;

    x2=1;

    while(day>0)

    {

    x1=(x2+1)*2;/*第一天的桃子数是第2天桃子数加1后的2倍*/

    x2=x1;

    day--;

    }

    printf("the total is %dn",x1);

    getch();

    }

相关问题