/
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 233 点
問題文
高橋君はスポーツクラブの会員証を持っています。会員証には会員番号として正の整数 N が書かれています。
このクラブでは、会員番号を十進法で表したときの各桁の数字の和を「ラッキーナンバー」と呼んでいます。たとえば会員番号が 2024 なら、ラッキーナンバーは 2 + 0 + 2 + 4 = 8 です。
高橋君のラッキーナンバーを求めてください。
制約
- 1 \leq N \leq 10^9
- N は整数
入力
入力は以下の形式で標準入力から与えられる。
N
- 1 行目には、会員番号 N が与えられる。
出力
高橋君のラッキーナンバーを 1 行で出力せよ。
入力例 1
2024
出力例 1
8
入力例 2
7
出力例 2
7
入力例 3
1000000000
出力例 3
1
入力例 4
7262570
出力例 4
29
入力例 5
690065536
出力例 5
40
Score : 233 pts
Problem Statement
Takahashi has a membership card for a sports club. A positive integer N is written on the card as his membership number.
The club calls the sum of the digits of the membership number in decimal notation the "lucky number." For example, if the membership number is 2024, the lucky number is 2 + 0 + 2 + 4 = 8.
Find Takahashi's lucky number.
Constraints
- 1 \leq N \leq 10^9
- N is an integer.
Input
The input is given from Standard Input in the following format:
N
- The first line contains the membership number N.
Output
Print Takahashi's lucky number in a single line.
Sample Input 1
2024
Sample Output 1
8
Sample Input 2
7
Sample Output 2
7
Sample Input 3
1000000000
Sample Output 3
1
Sample Input 4
7262570
Sample Output 4
29
Sample Input 5
690065536
Sample Output 5
40