exchange


Submit solution

Points: 10 (partial)
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
Java 19, Java 8

題目說明

輸入兩個整數,分別存入 a, b 兩變數中,將兩變數數值交換後輸出。補齊下方缺少的程式碼,禁止直接修改。

輸入值的格式

輸入兩個整數

輸出值的格式

輸出a b兩變數交換的結果

程式碼

public class main {

    public static void main(String[] args) {

        int a = // 輸入 a 的數值
        int b = // 輸入 b 的數值

        // 將a b 數值交換後輸出

        System.out.print(a + " " + b);
    }

}

sample input1

1 2

sample output1

2 1

sample input2

4 5

sample output2

5 4

Comments

There are no comments at the moment.