30. 秘密差
user_6817964
c_cpp
3 years ago
294 B
7
Indexable
int main() {
int x;
scanf("%d", &x);
int a = 0, b = 0;
while (x > 0) {
a += (x % 10);
x = x / 10;
b += (x % 10);
x = x / 10;
}
if (a > b) {
printf("%d", a - b);
}
else {
printf("%d", b - a);
}
}Editor is loading...