Q. Write a program that the user for two number and prints close if the number are within 0.001 of each other and not close otherwise.


You can understand by Watching video :-



Answer :-

a = float(input("Enter first number :-"))
b = float(input("Enter second number :-"))
c = a - b
if c > 0.0009 and c <= 0.001 :
  print("Close")
else :
  print("Not close")

Output :-

Enter first number :-2
Enter second number :-3
Not close

>>>

Enter first number :-2.001
Enter second number :-2
Close

>>>

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post