Write a
program to take fraction number as input from console and convert the given
fraction into a floating point number and then extract the integer part and
fractional part of a number of that floating point number
Explanation:
1.Take input
of float data type
2.Convert it
into String data type
3.Split them
and store in 2 variables
4. print
them using output formatting
Code:
number = float(input())
str_number=str(number)
Integer,Float=str_number.split('.')
print(f"Integer:{Integer},Float:{Float}")
0 Comments
Post a Comment