日韩成人免费在线_国产成人一二_精品国产免费人成电影在线观..._日本一区二区三区久久久久久久久不

當前位置:首頁 > 科技  > 軟件

編程語言大比拼:Python、Java、C、C++、Go 實現 'Hello World' 和九九乘法表"

來源: 責編: 時間:2023-12-09 15:23:18 276觀看
導讀應該90%的IT專業的朋友寫的第一段代碼就是打印"holle world",每個大學老師都會通過這個方式吸引你對課程產生興趣。也許有的朋友學的是JAVA開發,有的學的是c,在幾年前應該很少有大學開了python、Golang相關課程,但是現

應該90%的IT專業的朋友寫的第一段代碼就是打印"holle world",每個大學老師都會通過這個方式吸引你對課程產生興趣。也許有的朋友學的是JAVA開發,有的學的是c,在幾年前應該很少有大學開了python、Golang相關課程,但是現在不一樣,隨著開發語言的成熟度越來越高,國內對研發的重視,可能很多學校都開設了python、Go語言等課程。0NB28資訊網——每日最新資訊28at.com

0NB28資訊網——每日最新資訊28at.com

今天通過 Python、Java、C、C++ 和 Go 這幾種流行的編程語言來實現兩個經典的編程練習:0NB28資訊網——每日最新資訊28at.com

  • 打印 "Hello World"
  • 輸出九九乘法表

打印 "Hello World"

用 Python 實現:0NB28資訊網——每日最新資訊28at.com

print("Hello, World!")

用 Java 實現:0NB28資訊網——每日最新資訊28at.com

public class HelloWorld {    public static void main(String[] args) {        System.out.println("Hello, World!");    }}

用 C 實現:0NB28資訊網——每日最新資訊28at.com

#include <stdio.h>int main() {    printf("Hello, World!/n");    return 0;}

用 C++ 實現:0NB28資訊網——每日最新資訊28at.com

#include <iostream>int main() {    std::cout << "Hello, World!" << std::endl;    return 0;}

用 Go 實現:0NB28資訊網——每日最新資訊28at.com

package mainimport "fmt"func main() {    fmt.Println("Hello, World!")}

打印九九乘法表

用 python 實現:0NB28資訊網——每日最新資訊28at.com

for i in range(1, 10):    for j in range(1, i+1):        print(f"{j} * {i} = {i*j}", end='/t')    print()

用JAVA實現:0NB28資訊網——每日最新資訊28at.com

public class MultiplicationTable {    public static void main(String[] args) {        for (int i = 1; i <= 9; i++) {            for (int j = 1; j <= i; j++) {                System.out.print(j + " * " + i + " = " + (i*j) + "/t");            }            System.out.println();        }    }}

用 C 實現:0NB28資訊網——每日最新資訊28at.com

#include <stdio.h>int main() {    int i, j;    for (i = 1; i <= 9; i++) {        for (j = 1; j <= i; j++) {            printf("%d * %d = %d/t", j, i, i*j);        }        printf("/n");    }    return 0;}

用 C++ 實現:0NB28資訊網——每日最新資訊28at.com

#include <iostream>int main() {    for (int i = 1; i <= 9; i++) {        for (int j = 1; j <= i; j++) {            std::cout << j << " * " << i << " = " << i*j << "/t";        }        std::cout << std::endl;    }    return 0;}

用 Go 實現:0NB28資訊網——每日最新資訊28at.com

package mainimport "fmt"func main() {    for i := 1; i <= 9; i++ {        for j := 1; j <= i; j++ {            fmt.Print(j, " * ", i, " = ", i*j, "/t")        }        fmt.Println()    }}


0NB28資訊網——每日最新資訊28at.com

本文鏈接:http://www.www897cc.com/showinfo-26-40676-0.html編程語言大比拼:Python、Java、C、C++、Go 實現 'Hello World' 和九九乘法表&quot;

聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。郵件:2376512515@qq.com

上一篇: 你知道怎樣在 Python 中管理內存嗎

下一篇: B站邊緣網絡四層負載均衡器的探索與應用

標簽:
  • 熱門焦點
Top 主站蜘蛛池模板: 黄大仙区| 新源县| 东丰县| 桦南县| 郴州市| 东乡族自治县| 长顺县| 鲜城| 奎屯市| 靖边县| 应城市| 溧阳市| 石林| 甘洛县| 万州区| 太仓市| 盘锦市| 宽城| 中牟县| 错那县| 九江市| 洛扎县| 昌江| 郯城县| 黎平县| 辽宁省| 内乡县| 安陆市| 锡林郭勒盟| 久治县| 新源县| 双牌县| 什邡市| 武宣县| 淅川县| 民乐县| 石屏县| 三穗县| 定州市| 凌云县| 平原县|