Computer Science, asked by vermanisashank, 7 months ago

Consider following code fragment of
Python to get sum of two numbers:
A= input("Enter first number")
B = input("Enter Second number")
C = A + B
print ("Sum is =", C)
Output of above code is 4535, if value of A
is 45 and B is 35. Correct the above code to
get correct output.

Answers

Answered by bikeshsingh611
6

Answer:

A&B are string here and strings gets concatinated side by side when we use + sign

You have to type cast A, B, C into integer.

put int(input("Enter first number"))

same for B

then int C = A+B should work fine ...

Answered by thakurshauryaraj
1

u vruksh ke niche se upar uthkar

Similar questions