当前位置:网站首页>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
边栏推荐
- setcontext getcontext makecontext swapcontext
- Parameter stack pressing problem of C language in structure parameter transmission
- AT89C51 MCU digital voltmeter development, measuring range 0 ~ 5V, proteus simulation, schematic diagram, PCB and C program, etc
- man man随记和crontab的@reboot用法
- 交通灯系统51单片机设计(附Proteus仿真、C程序、原理图及PCB、论文等全套资料)
- MQ-2和DS18B20的火灾温度-烟雾报警系统设计,51单片机,附仿真、C代码、原理图和PCB等
- 51 Single Chip Microcomputer Design of traffic light system (with Proteus simulation, C program, schematic diagram, PCB, thesis and other complete data)
- C语言p2选择分支语句详解
- Introduction to the use of countdownlatch and cyclicbarrier for inter thread control
- 在电视屏幕上进行debug调试
猜你喜欢
MCU function signal generator, output four kinds of waveforms, adjustable frequency, schematic diagram, simulation and C program
KVM learning resources
四层和八层电梯控制系统Proteus仿真设计,51单片机,附仿真和Keil C代码
TLS/SSL 协议详解 (28) TLS 1.0、TLS 1.1、TLS 1.2之间的区别
redis的五种数据类型
On the insecurity of using scanf in VS
关于在vs中使用scanf不安全的问题
本以为能躺着进华为,结果陆续收到京东/滴滴/爱奇艺offer的我迷茫了
asp.net使用MailMessage发送邮件的方法
Nacos uses demo as configuration center (IV)
随机推荐
Preview CSV file
JS parabola motion packaging method
Proteus simulation design of four storey and eight storey elevator control system, 51 single chip microcomputer, with simulation and keil c code
bc的用法
JS format time
编译Openssl
KVM learning resources
Logical volume creation and expansion
Solve the problem of SSH configuration file optimization and slow connection
Docker (V) MySQL installation
flannel 原理 之 子网划分
Man man notes and @ reboot usage of crontab
Redis源码分析之PSYNC同步
MCU function signal generator, output four kinds of waveforms, adjustable frequency, schematic diagram, simulation and C program
Introduction to loan market quotation interest rate (LPR) and loan benchmark interest rate
source insight via samba
js 抛物线运动方法封装
Gif to still image processing
async void 导致程序崩溃
修改Firebase Emulators的默认侦听IP