当前位置:网站首页>Daily practice of C language --- monkeys divide peaches
Daily practice of C language --- monkeys divide peaches
2022-07-02 13:30:00 【Edsu】
subject :
There is a pile of peaches on the beach , Five monkeys to share . The first monkey divided the pile of peaches into five parts , More One , The monkey threw one more into the sea , Took a share of . The second monkey divided the remaining peaches equally In five , One more , It also throws one more into the sea , Took a share of , Third 、 Fourth 、 Fifth Monkeys do this , Ask how many peaches there used to be on the beach ?
The code analysis :
#include <stdio.h>
#include<stdlib.h>
int main(){
int x=0,i=0,j=1;//i Indicates the number of times of execution
while(i<5){//j It means the number of peaches the monkey finally got
x=4*j;
for(i=0;i<5;i++){
if(x%4!=0)
break;
x=(x/4)*5+1;}
j++;}
printf("%d\n",x);// After averaging each time , Take the total after .
return 0;
} Code effect :

Monkeys at least used to have 3121 A peach !
边栏推荐
- Unity skframework Framework (XVI), package manager Development Kit Manager
- 题解:《你的飞碟在这儿》、《哥德巴赫猜想》
- (6) Web security | penetration test | network security encryption and decryption ciphertext related features, with super encryption and decryption software
- Crowncad (crown CAD), the first fully independent 3D CAD platform based on Cloud Architecture in China
- Jerry's watch stops ringing [article]
- Finally, someone explained the supervised learning clearly
- de4000h存储安装配置
- PR usage skills, how to use PR to watermark?
- Japan bet on national luck: Web3.0, anyway, is not the first time to fail!
- 每日一题:1175.质数排列
猜你喜欢

最近公共祖先LCA的三种求法

Unity skframework framework (XVIII), roamcameracontroller roaming perspective camera control script
![[技术发展-22]:网络与通信技术的应用与发展快速概览-2- 通信技术](/img/a7/44609a5acf25021f1fca566c3d8c90.png)
[技术发展-22]:网络与通信技术的应用与发展快速概览-2- 通信技术

Unity skframework framework (XIV), extension extension function

Unity skframework framework (XXI), texture filter map resource filtering tool

Chinese name extraction (toy code - accurate head is too small, right to play)

2022零代码/低代码开发白皮书【伙伴云出品】附下载

【蓝桥杯选拔赛真题43】Scratch航天飞行 少儿编程scratch蓝桥杯选拔赛真题讲解

Ali was killed by two programming problems at the beginning, pushed inward again, and finally landed (he has taken an electronic offer)

Fully autonomous and controllable 3D cloud CAD: crowncad's convenient command search can quickly locate the specific location of the required command.
随机推荐
What are the classifications of SSL certificates? How to choose the appropriate SSL certificate?
Why is the default of switch followed by break?
[Unity]使用GB2312,打包后程序不正常解决方案
nohup命令
Research shows that "congenial" is more likely to become friends
2022 Heilongjiang provincial examination on the writing skills of Application Essays
Unity skframework framework (XVI), package manager development kit Manager
诚邀青年创作者,一起在元宇宙里与投资人、创业者交流人生如何做选择……...
[indomitable medal activity] life goes on and writing goes on
Why can't d link DLL
ADB basic commands
为什么switch 的default后面要跟break?
Record idea shortcut keys
Numpy array calculation
We sincerely invite young creators to share with investors and entrepreneurs how to make choices in life in the metauniverse
Finally, someone explained the supervised learning clearly
JS reverse massive creative signature
De4000h storage installation configuration
Unity skframework framework (XX), VFX lab special effects library
国内首款、完全自主、基于云架构的三维CAD平台——CrownCAD(皇冠CAD)