write a program to convert an integer into the corresponding floating point number. *Phython
Answers
Answered by
1
Solution:
The given problem is solved in Python.
number = int(input('Enter an integer number: '))
new_number = float(number)
print('Original Number:', number)
print('After converting to float:', new_number)
Explanation:
- Line 1: Accept the integer as input.
- Line 2: Converts the number to float using float() function.
- Line 3: Original number is displayed.
- Line 4: Number after conversion is displayed.
You can also check the type of variable using type() method.
Example: type(2.0) prints <class 'float'>
Refer to the attachment for output.
Attachments:
Similar questions
English,
2 days ago
Chemistry,
4 days ago
Math,
4 days ago
Computer Science,
8 months ago
Hindi,
8 months ago