You may have solved this already.
But, what if the two numbers are like this:
12303
13801
You may have solved this already.
But, what if the two numbers are like this:
12303
13801
@hjr265 @Rax_bot @imamanik05 @mahfuzAhmed @tanmoy_03 @Shimanto
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)
[REDACTED]
#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?
I think you meant to write rem2=b%10;
here (%
, not &
).
#include <stdio.h>
int main(void)
{
int a, b, na[1000], nb[1000], i = 0, j = 0, x, y, num, count = 0;
scanf("%d%d", &a, &b);
while (a > 0)
{
na[i] = a % 10;
a /= 10;
i++;
}
while (b > 0)
{
nb[j] = b % 10;
b /= 10;
j++;
}
for (x = i - 1, y = j - 1; x >= 0 || y >= 0; x--, y--)
{
num = na[x] + nb[y];
if (num > 9)
{
count++;
}
}
if (count > 0)
{
printf("Yes");
}
else
{
printf("No");
}
return 0;
}
This code failed in test case 6.Help me… i tried
123456
123
and aswer was no.
@user.997422 Try this input:
19
3
it saying yes on vscode but no on top’s editor , why?
I used the code from your last message in IdeOne.com: https://ideone.com/Of664L
Are you sure you are running the same code locally?
What is wrong this code?
Try an input like 1118 1118
.
It’s also right
@hjr265 newline issues with d8.
Thanks for reporting this. Your submission has been rejudged.
int main() {
int a,b;
scanf(“%d%d”,&a,&b);
int i,j,k,l;
int arr1[100];
int arr2[100];
int m=a;
int n=b;
int c1=0,c2=0;
for(j=0;m!=0;j++)
{
i=m%10;
m=m/10;
arr1[j]=i;
c1++;
}
for(j=0;n!=0;j++)
{
k=n%10;
n=n/10;
arr2[j]=k;
c2++;
}
int max=c1;
if(c2>c1) max=c2;
int sum=0;
int c3=0;
for(j=0;j<max;j++)
{
sum=arr1[j]+arr2[j];
if(sum>9) c3++;
}
if(c3>0) printf("yes\n");
else printf("No\n");
return 0;
}
what’s wrong with this code? this code failed in 5th test case