MeetCode
Digit Sum Mod 9
C
C++
Computer Mathematics
CSS
DSA
HTML
Java
JavaScript
NodeJS
PHP
Programming Interview
Python
ReactJS
SQL
Run
Submit
Dark
Problem Statement
Solutions
Submissions
Digit Sum Mod 9
Medium
Computer Mathematics
Integers & Divisibility
37 views
Explanation
Complexity
Problem Statement
Given a big number as string, print its digit sum modulo 9.
Input Format
One line: digits string s.
Output Format
One integer 0-8.
Constraints
1
Input / Output Format
Input Format
One line: digits string s.
Output Format
One integer 0-8.
Constraints
1
Examples
Input:
999999999999
Output:
0
Example Solution (Public)
Computer Mathematics
Sum digits, take modulo 9 while adding to avoid big numbers.
Official Solution Code
Wrap
Copy
Sum digits, take modulo 9 while adding to avoid big numbers.
Please
login
to submit solutions.
Editor
C
C++
Computer Mathematics
CSS
DSA
HTML
Java
JavaScript
NodeJS
PHP
Programming Interview
Python
ReactJS
SQL
Test Cases
Output
Submission Result
Input
999999999999
Expected Output
0
Compile Output
Error
Output
Please
login
to submit solutions.