You may have solved this already.

But, what if the two numbers are like this:

``````12303
13801
``````

# What’s the Wrong with this Python code ? stuck in problem 7

``````
x, y = map(int, input().split())

def CarrierSLogic(x, y):
# listing First
x_list = list(str(x))
y_list = list(str(y))
# print(x_list)

if len(x_list) > len(y_list):
i = len(y_list)

else:
i = len(x_list)

# print(i)

# swaping x_list
x_list = x_list[::-1]

for j in range(0, i):
if int(x_list[j]) + int(y_list[j]) >= 10:
print("Yes")
exit()

print("No")

if __name__ == "__main__":
CarrierSLogic(x, y)

``````

# Finally after trying about 1 hour, this works

``````[REDACTED]
``````
1 Like
``````#include<stdio.h>
int main(){
int a,b,rem1,rem2,flag=0;
scanf("%d %d",&a,&b);

while(a>0  && b>0){
rem1=a%10;
a/=10;

rem2=b&10;
b/=10;

if(rem1+rem2>9){
flag=1;
break;
}
}
if(flag==1){
printf("Yes");
}else{
printf("No");
}
return 0;
}
``````

i got: Wrong answer on test 4; what is the problem in my code?

1 Like

I think you meant to write `rem2=b%10;` here (`%`, not `&`).

1 Like