Kotlin學習筆記(19) 99乘法表
fun main(args : Array<String>){
multiplication9x9Table()
}
fun multiplication(a: Int, b: Int) = a * b //Kotlin新特性!!!!
fun multiplication9x9Table(){
for(i in 0..9){
if(i==0){
//打印第一行
for(i in 0..9){
if(i==0)
print("* ")
else
print("$i ")
}
println()
} else {
print("$i ") //打印第一列
for(j in 1..i){
//打印内容
print(multiplication(i,j).toString()+" ")
}
println() //换行
}
}
}
輸出畫面
* 1 2 3 4 5 6 7 8 9
1 1
2 2 4
3 3 6 9
4 4 8 12 16
5 5 10 15 20 25
6 6 12 18 24 30 36
7 7 14 21 28 35 42 49
8 8 16 24 32 40 48 56 64
9 9 18 27 36 45 54 63 72 81
訂閱:
張貼留言 (Atom)
ESP32 微控制器 採集的環境數據,經由 MQTT 協定 轉換並寫入工業標準的 Modbus 暫存器 中
一個典型的 IoT(物聯網)與工業自動化系統整合(SCADA/機台連線) 的架構圖。它透過 Node-RED 作為核心資料網關,將前端 ESP32 微控制器 採集的環境數據,經由 MQTT 協定 轉換並寫入工業標準的 Modbus 暫存器 中。 1. 各模組功能拆解...
-
Line 發報機 Python TKinter (CONFIG_LINE Message API_2.py) import serial import serial.tools.list_ports import tkinter as tk from tkinter import...
-
python pip 不是内部或外部命令 -- 解決方法 要安裝 Pyqt5 1. 首先,開啟命令提示字元。 2. 輸入 pip3 install pyqt5 好像不能執行 ! ! 錯誤顯示 : ‘ pip3 ’ 不是內部或外部命令、可執行的程式或批...
-
課程講義 下載 11/20 1) PPT 下載 + 程式下載 http://www.mediafire.com/file/cru4py7e8pptfda/106%E5%8B%A4%E7%9B%8A2-1.rar 11/27 2) PPT 下載...
沒有留言:
張貼留言