add number


Submit solution

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

Author:
Problem type
Allowed languages
Java 19, Java 8

題目說明

輸入一個四位整數,將每個位數加總後輸出。

輸入值的格式

一個四位整數

輸出值的格式

每個位數加總後結果

參考程式碼

import java.util.Scanner;
public class main {

    public static void main(String[] args) {
        // TODO Auto-generated method stub

    }

}

sample input1

1234

sample output1

10

解釋:1+2+3+4=10

sample input2

1213

sample output2

7

解釋:1+2+1+3=7


Comments

There are no comments at the moment.