Back

Codekata looping qno 5

Created 3 years ago
1434 Views
2 Comments
SurentharAmigo
@SurentharAmigo
SurentharAmigo
@SurentharAmigoProfile is locked. Login

Write a code to get 2 integers as input and add the integers without any carry.

Input Description:
A single line containing 2 integers.

Output Description:
Print sum of the 2 integers without carry

Sample Input :
44 66
Sample Output :
0

a, b = list(map(int, input().split()))

c = a + b

d = str(c)
A = str(a)
B = str(b)

if c < 110 and ( len(d) > len(A) or len(d) > len(B)) :
    print(d[-1])
    
elif c > 110 :
    print((c - 100)/2)
    
else:
    print(c)

All test case passed

But please explain how to solve using loop function

Comments (2)
Please login to comment.