当前位置:网站首页>Find daffodils - for loop practice
Find daffodils - for loop practice
2022-04-23 14:26:00 【Zinksl】
:::info
according to Forgetting curve : If there is no record and review ,6 Days later, I will forget 75% The content of
Reading notes are a tool to help you record and review , Don't stick to form , Its core is : Record 、 Look over 、 reflection
:::
Narcissistic number (Narcissistic number) It's also called super perfect number invariant (pluperfect digital invariant, PPDI)、 Narcissistic number 、 Self idempotent 、 Armstrong number or Armstrong number (Armstrong number), The number of Narcissus refers to a 3 digit , Of the numbers in each of its bits 3 The sum of the powers is equal to itself .
Case needs
demand 1 Find out the number of all daffodils
1 adopt for Loop through three digits
2 adopt if According to the concept of narcissus number , The number of daffodils in the sun
//for Cycle to find the number of daffodils
for (int i=100;i<=999;i++){
int ge,shi,bai; // Define everyone 、 ten 、 Hundreds of variables are ready for subsequent operations
ge = i%10;
shi = i/10%10;
bai = i/100;
// use if The conditions of daffodil number were screened
if (i==(ge*ge*ge+shi*shi*shi+bai*bai*bai)){
System.out.println(" Narcissistic number :"+i);
}
}
Conclusion
If there are any questions in the text , Welcome to correct , Welcome to discuss
See here , Just order a compliment and go ღ( ´・ᴗ・` ) finger heart
版权声明
本文为[Zinksl]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231412046288.html
边栏推荐
- Mq-2 and DS18B20 fire temperature smoke alarm system design, 51 single chip microcomputer, with simulation, C code, schematic diagram, PCB, etc
- js 格式化时间
- JS progress bar, displaying the loading progress
- Qt实战:云曦日历篇
- source insight via samba
- On the insecurity of using scanf in VS
- 金九银十,入职字节跳动那一天,我哭了(蘑菇街被裁,奋战7个月拿下offer)
- 循环队列的基本操作,你学会了吗?
- Electronic scale weighing system design, hx711 pressure sensor, 51 single chip microcomputer (proteus simulation, C program, schematic diagram, thesis and other complete data)
- 51单片机的花卉、农田自动浇水灌溉系统开发,Proteus仿真,原理图和C代码
猜你喜欢
51 MCU + LCD12864 LCD Tetris game, proteus simulation, ad schematic diagram, code, thesis, etc
MQ-2和DS18B20的火灾温度-烟雾报警系统设计,51单片机,附仿真、C代码、原理图和PCB等
进入新公司,运维工程师从下面这几项了解系统的部署
处理 mkdir:无法创建目录“aaa“:只读文件系统
TLS/SSL 协议详解 (30) SSL中的RSA、DHE、ECDHE、ECDH流程与区别
电子秤称重系统设计,HX711压力传感器,51单片机(Proteus仿真、C程序、原理图、论文等全套资料)
Processing MKDIR: unable to create directory 'AAA': read only file system
API Gateway/API 网关(二) - Kong的使用 - 负载均衡Loadbalance
Nacos作为配置中心(四) 使用Demo
API gateway / API gateway (IV) - use of Kong - Integrated JWT and fuse plug-in
随机推荐
grep无法重定向到文件的问题
SSH 通过跳板机连接远程主机
Golang 对分片 append 是否会共享数据
统信UOS卸载php7.2.24,安装php7.4.27 ;卸载再安装为PHP 7.2.34
Redis cluster 原理
Web page, adaptive, proportional scaling
Use the executors class to quickly create a thread pool
Notes on Visio drawing topology
Electronic perpetual calendar of DS1302_ 51 single chip microcomputer, month, day, week, hour, minute and second, lunar calendar and temperature, with alarm clock and complete set of data
C语言知识点精细详解——数据类型和变量【2】——整型变量与常量【1】
ansible及常用模块的使用
LLVM - 生成for循环
流程控制之分支语句
setcontext getcontext makecontext swapcontext
A blog allows you to learn how to write markdown on vscode
LLVM - 生成 if-else 以及 PH
Multisim Simulation Design of DC adjustable regulated power supply of LM317 (with simulation + paper + reference)
PWM speed regulation control system of DC motor based on 51 single chip microcomputer (with complete set of data such as Proteus simulation + C program)
Matrix exchange row and column
AT89C52单片机的频率计(1HZ~20MHZ)设计,LCD1602显示,含仿真、原理图、PCB与代码等