fmod()

Module of input numbers
fmod(x,y)
Example
print(math.fmod(10,2)) # 0.0
print(math.fmod(10,3)) # 1.0
print(math.fmod(10,4)) # 2.0
Output will carry sign of x
print(math.fmod(10,-2))   # 0.0
print(math.fmod(10,-3))   # 1.0
print(math.fmod(10,4))    # 2.0
print(math.fmod(-10,4))   # -2.0
x is float here
print(math.fmod(10.34,4)) # 2.34
print(math.fmod(10,0))    # ValueError: math domain error
Using for loop
for i in range(0,10):
    print("fmod(",i,",2) = ",math.fmod(i,2))
Output
fmod( 0 ,2) =  0.0
fmod( 1 ,2) =  1.0
fmod( 2 ,2) =  0.0
fmod( 3 ,2) =  1.0
fmod( 4 ,2) =  0.0
fmod( 5 ,2) =  1.0
fmod( 6 ,2) =  0.0
fmod( 7 ,2) =  1.0
fmod( 8 ,2) =  0.0
fmod( 9 ,2) =  1.0


plus2net.com



Post your comments , suggestion , error , requirements etc here




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2020 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer