Write a program that accepts a number as input, and prints just the decimal portion. Your program should also work if a negative number is inputted by the user. Sample Run Enter a number: 15.789 Sample Output 0.789
Answers
Answered by
0
Answer:
import math
a=int(input("ent value of a\n"))
b=int(input("ent value of b\n"))
i,j=(math.modf(a/b))
print("decimal part of fraction=",i)
print("non decimal part of fraction=",j)
Explanation:
It is the program written in PYTHON
Here I used the math module which contain the modf() method which gives decimal and non decimal part separately
Output is attached look at
HOPE IT HELPS YOU
DO FOLLOW FOR MORE PROGRAMS
MARK AS BRAINLIEST
Attachments:
Similar questions