当前位置:网站首页>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 !
边栏推荐
- Chinese name extraction (toy code - accurate head is too small, right to play)
- Why is the default of switch followed by break?
- 免费SSL证书知多少?免费SSL证书和收费SSL证书的区别
- linux下清理系统缓存并释放内存
- 为什么switch 的default后面要跟break?
- 最近公共祖先LCA的三种求法
- 【youcans 的图像处理学习课】总目录
- West digital decided to raise the price of flash memory products immediately after the factory was polluted by materials
- Unity SKFramework框架(二十一)、Texture Filter 贴图资源筛选工具
- 2022零代码/低代码开发白皮书【伙伴云出品】附下载
猜你喜欢

最近公共祖先LCA的三种求法
![Lucky numbers in the [leetcode daily question] matrix](/img/c8/47a22644bf8cc1f49c5668d72161b6.jpg)
Lucky numbers in the [leetcode daily question] matrix
![Jerry's watch gets the default ringtone selection list [article]](/img/94/e469864fa6ab688dabe46f606efdbc.jpg)
Jerry's watch gets the default ringtone selection list [article]

We sincerely invite young creators to share with investors and entrepreneurs how to make choices in life in the metauniverse

运维必备——ELK日志分析系统

West digital decided to raise the price of flash memory products immediately after the factory was polluted by materials

挥发性有机物TVOC、VOC、VOCS气体检测+解决方案

【云原生数据库】遇到慢SQL该怎么办(上)?

OpenApi-Generator:简化RESTful API开发流程

Performance optimization of memory function
随机推荐
每日一题:1175.质数排列
科技的成就(二十七)
Independent and controllable 3D cloud CAD: crowncad enables innovative design of enterprises
免费SSL证书知多少?免费SSL证书和收费SSL证书的区别
nohup命令
MAC (MacOS Monterey 12.2 M1) personal use PHP development
De4000h storage installation configuration
Jerry's watch gets the default ringtone selection list [article]
Jerry's watch modifies the alarm clock [chapter]
Principle analysis of security rememberme
[200 opencv routines] 100 Adaptive local noise reduction filter
Unity skframework framework (XVII), freecameracontroller God view / free view camera control script
The second anniversary of the three winged bird: the wings are getting richer and the take-off is just around the corner
互联网常见34个术语解释
ADB basic commands
2022 zero code / low code development white paper [produced by partner cloud] with download
Daily question: 1175 Prime permutation
Partner cloud form strong upgrade! Pro version, more extraordinary!
SAP MM 因物料有负库存导致MMPV开账期失败问题之对策
Jerry's watch ringtone audition [article]