Divisible By 11

Divisible By 11

Medium Computer Mathematics Integers & Divisibility 32 views
Explanation Complexity

Problem Statement

Check divisibility by 11 using digit positions rule.

Input Format

One non-negative integer n.

Output Format

YES or NO.

Example

121
YES

Constraints

0

Input / Output Format

Input Format
One non-negative integer n.
Output Format
YES or NO.
Constraints
0

Examples

Input:
121
Output:
YES

Example Solution (Public)

Computer Mathematics
Compute alternating sum of digits (odd positions minus even positions). If the difference is divisible by 11, print YES.

Official Solution Code

Compute alternating sum of digits (odd positions minus even positions). If the difference is divisible by 11, print YES.
Please login to submit solutions.
Editor
Output

                                        
Please login to submit solutions.