Functions
Function-11
Function-12
Function-13
~/algor $ cat problems/funksiya-baxtli-chiptalar
Lucky ticket
Easy
2000 ms
128 MB
23%
Write a function IsLucky(x) that returns true if the six-digit ticket number $x$ is lucky and false otherwise. The ticket number is written with six digits, padded with leading zeros ($1020$ is $001020$). A ticket is lucky if the sum of its first three digits equals the sum of its last three digits.
Example 1: IsLucky(123060) → true — $1 + 2 + 3 = 0 + 6 + 0$.
Example 2: IsLucky(1020) → false — in $001020$: $0 + 0 + 1 \ne 0 + 2 + 0$.
Write only the function body.
Input
One line with a non-negative integer $x$ — the argument of the function.
Output
The value returned by the function: true or false.
Note
$0 \le x \le 999999$
Examples
Input #1
123060
Output #1
true
Input #2
1020
Output #2
false