2019年5月21日 星期二

Kotlin 高中程式練習題 a001: 哈囉

Kotlin 高中程式練習題 a001: 哈囉

學習所有程式語言的第一個練習題 
請寫一個程式,可以讀入指定的字串,並且輸出指定的字串。

使用 online Kotlin https://www.jdoodle.com/compile-kotlin-online

範例輸入

world
C++
mary


範例輸出
hello, world
hello, C++
hello, mary

fun main(args: Array<String>) {
    var line : String?
    do {
        line = readLine()
        if (line == null)
            break
        println("Hello , $line")
    } while (true)
}   

輸出結果
Hello , world
Hello  , C++
Hello , mary




沒有留言:

張貼留言

WOKWI ESP32 模擬RFID ,LED + Python TKinter SQLite

 WOKWI ESP32 模擬RFID ,LED + Python TKinter SQLite  WOKWI ESP32程式 #include <SPI.h> #include <MFRC522.h> #include <WiFi.h> #i...