Files
Java/Experiment/graph/Exp7/FibonacciSeq.mermaid
2025-11-06 10:29:13 +08:00

19 lines
616 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
flowchart TD
A[开始] --> B["定义 n=20并创建 int[] fib"]
B --> C["fib[0]=0; fib[1]=1"]
C --> D["循环 i=2~19 计算 fib[i]=fib[i-1]+fib[i-2]"]
D --> E[生成完毕,打开 FileWriter 写入 in.txt]
E --> F[初始化 i=0]
F --> G{是否 i < n?}
G -- 是 --> H["写入 fib[i] 的字符串形式"]
H --> I{"(i+1)%5==0?"}
I -- 是 --> J["写入 \n"]
I -- 否 --> K{i < n-1?}
K -- 是 --> L["写入 , "]
K -- 否 --> M[不写分隔符]
J --> N[i++]
L --> N[i++]
M --> N[i++]
N --> G
G -- 否 --> O[关闭 FileWriter]
O --> P[程序结束]