use of modulus operator: how can we use modulus operator with double type variables

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ksumrani
    New Member
    • Mar 2013
    • 1

    use of modulus operator: how can we use modulus operator with double type variables

    how can we use modulus operator with double type variables
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    You can't. The modulus operator is for integers only.

    Comment

    • whodgson
      Contributor
      • Jan 2007
      • 542

      #3
      Well one of my books suggests that fmod() can be used with floats and doubles to obtain a remainder. e.g.:
      Code:
      cout<<fmod(7.6,2.5);//prints 0.1.
      But fmod() is not the % operator as stated above.

      Comment

      Working...