Computer Science, asked by ayanahmadkhanmake, 5 months ago

Why the code given below is not giving desired output. We want to input value as 10
and obtain output as 20. Could you pinpoint the problem? 2
Number = input(“enter number”)
DoubleTheNumber = Number * 2
Print(DoubleTheNumber)

Answers

Answered by Oreki
2

Answer:

Replace first line with,

Number = int(input(“enter number”))

Or, second line with,

DoubleTheNumber = int(Number) * 2

Explanation:

The program produced undesirable output because the number was not converted to integer.

Answered by anindyaadhikari13
4

Answer:-

The Following program is not giving the desired output as the number was not converted to integer.Here number is a string variable and so it's not giving desired output.

Write this,

number=int(input("Enter number: "))

Then the problem will be solved.

Similar questions