当前位置:网站首页>Case - recursive factorial (recursive)
Case - recursive factorial (recursive)
2022-06-13 05:05:00 【Jason_ LH1024】


package it.com;
public class DiGuiDemo02 {
public static void main(String[] args) {
int result = jc(5);
System.out.println("5 The factorial is :" + result);
}
// Define a method , For recursively factoring , Parameter is one int Variable of type
public static int jc(int n) {
// Determine whether the value of the variable is 1
if (n == 1) {
// yes , Then return to 1
return 1;
} else {
// No , Then return to n*(n-1)!
return n * jc(n - 1);
}
}
}

边栏推荐
- RuoYi-Cloud启动教程(手把手图文)
- PostgreSQL Guide: inside exploration (Chapter 10 basic backup and point in time recovery) - Notes
- Section 7 - structures
- C language learning log 1.2
- 语音信号分帧的理解
- Clause 33: decltype is used for auto & type formal parameters, with std:: forward
- C language learning log 10.8
- Understanding of speech signal framing
- Embedded hardware: electronic components (1) resistance capacitance inductance
- 135. distribute candy
猜你喜欢

lookup

Interpretation of QT keypressevent

Embedded hardware - read schematic

The games that you've tasted

Advanced C - Section 2 - pointers

Reductive elimination

Bm1z002fj-evk-001 startup evaluation

What is the saturate operation in opencv

Pycharm错误解决:Process finished with exit code -1073741819 (0xC0000005)

Several methods of identifying equivalent circuit of circuit drawing
随机推荐
Section 3 - functions
What is the difference between ROM, ram and flash? SRAM、DRAM、PROM、EPROM、EEPROM
PostgreSQL Guide: inside exploration (Chapter 10 basic backup and point in time recovery) - Notes
Luogu p3654 fisrt step
详解OpenCV的函数cv::add(),并附各种情况的示例代码和运行结果
Sort (internal sort) + external sort
LeetCode第297场周赛(20220612)
Bm1z002fj-evk-001 startup evaluation
[thread / multithread] execution sequence of threads
Luogu p1012 guess
QT realizes message sending and file transmission between client and server
Std:: Map empty example
Gradient descent, learning rate
System file interface open
Embedded hardware: electronic components (1) resistance capacitance inductance
RuoYi-Cloud启动教程(手把手图文)
Search DFS and BFS
【多线程】线程池核心类-ThreadPoolExecutor
shell变量学习笔记
What is the saturate operation in opencv