Shivi has written the following program but she is not getting the desired result .Why ? a=input(“enter a number”) b=input(“enter 2nd Number”) c=a+b print(c) (a) wrong coding b) type casting problem c) formula of sum is incorrect d) None
Answers
Answered by
2
Answer:
d
Explanation:
cuz she does not printing the output c in program
Answered by
0
Option(b) is the correct answer.
We are required to find the reason for not getting the desired result for the python program
"a=input(“enter a number”)
b=input(“enter 2nd Number”)
c=a+b
print(c)"
- In this program, The program takes input a and b values as a string because the values of a and b are not recognized as integers by the computer.
- So, The output sum will be as joining the terms a and b.
- If the int() function is used before the input then the desired result would have come.
These types of error in programming is known as type casting error.
If the string data type is not transformed into an integer data type in the required place then the error is known as a type casting error.
Therefore, Option(b) is the correct answer.
#SPJ2
Similar questions