c/c++语言开发共享C语言:每瓶汽水1元,两个空瓶可以置换一瓶汽水,现在有20元,最多能喝多少瓶汽水。

#include <stdio.h> #define max 20 int main() { int money=max; int count=max; whil

  #include <stdio.h>  #define max  20  int main()  {   int money=max;   int count=max;   while(1)   {    if(money%2!=0)    {     count=count+money-1;     break;     }     else    {     money=money/2;     count+=money;     }   }    printf("%dn",count);   return 0;  }

 

www.ctvol.com true Article c/c++语言开发共享C语言:每瓶汽水1元,两个空瓶可以置换一瓶汽水,现在有20元,最多能喝多少瓶汽水。

本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

ctvol管理联系方式QQ:251552304

本文章地址:https://www.ctvol.com/c-cdevelopment/605978.html

(0)
上一篇 2021年5月13日 下午3:58
下一篇 2021年5月13日 下午4:02

精彩推荐