Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. remainder

remainder

Scheduled Pinned Locked Moved C#
questioncsharphelp
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    R Thomas 0
    wrote on last edited by
    #1

    hi..... probably a stupid question...but can someone pls tell me how can i get the remainder of a devision in C#??? lets say 3/2 i need to get the reaminder and the quotient seperately... can anyone help? tks...:) Have a Super Blessed Day! ------------------------- For God has not given us a spirit of fear, but of power and of love and of a sound mind. 2 Timothy 1:7 "For God so loved the world that He gave His only begotten Son, that whoever believes in Him should not perish but have everlasting life." John 3:16 "Therefore you also be ready, for the Son of Man is coming at an hour you do not expet." Luke 12:40

    L D 2 Replies Last reply
    0
    • R R Thomas 0

      hi..... probably a stupid question...but can someone pls tell me how can i get the remainder of a devision in C#??? lets say 3/2 i need to get the reaminder and the quotient seperately... can anyone help? tks...:) Have a Super Blessed Day! ------------------------- For God has not given us a spirit of fear, but of power and of love and of a sound mind. 2 Timothy 1:7 "For God so loved the world that He gave His only begotten Son, that whoever believes in Him should not perish but have everlasting life." John 3:16 "Therefore you also be ready, for the Son of Man is coming at an hour you do not expet." Luke 12:40

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      3%2 =1 leppie::AllocCPArticle("Zee blog");
      Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.

      R 1 Reply Last reply
      0
      • L leppie

        3%2 =1 leppie::AllocCPArticle("Zee blog");
        Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.

        R Offline
        R Offline
        R Thomas 0
        wrote on last edited by
        #3

        are u saying if i do int 1 = 3%2 i will get 1? Have a Super Blessed Day! ------------------------- For God has not given us a spirit of fear, but of power and of love and of a sound mind. 2 Timothy 1:7 "For God so loved the world that He gave His only begotten Son, that whoever believes in Him should not perish but have everlasting life." John 3:16 "Therefore you also be ready, for the Son of Man is coming at an hour you do not expet." Luke 12:40

        R 1 Reply Last reply
        0
        • R R Thomas 0

          are u saying if i do int 1 = 3%2 i will get 1? Have a Super Blessed Day! ------------------------- For God has not given us a spirit of fear, but of power and of love and of a sound mind. 2 Timothy 1:7 "For God so loved the world that He gave His only begotten Son, that whoever believes in Him should not perish but have everlasting life." John 3:16 "Therefore you also be ready, for the Son of Man is coming at an hour you do not expet." Luke 12:40

          R Offline
          R Offline
          Rakesh Rajan
          wrote on last edited by
          #4

          Yep. That's exactly what he meant. % is a remainder operator in C#, just like / is for division. Rakesh Rakesh

          1 Reply Last reply
          0
          • R R Thomas 0

            hi..... probably a stupid question...but can someone pls tell me how can i get the remainder of a devision in C#??? lets say 3/2 i need to get the reaminder and the quotient seperately... can anyone help? tks...:) Have a Super Blessed Day! ------------------------- For God has not given us a spirit of fear, but of power and of love and of a sound mind. 2 Timothy 1:7 "For God so loved the world that He gave His only begotten Son, that whoever believes in Him should not perish but have everlasting life." John 3:16 "Therefore you also be ready, for the Son of Man is coming at an hour you do not expet." Luke 12:40

            D Offline
            D Offline
            Daniel M Edwards
            wrote on last edited by
            #5

            int intRemainder = 0; Math.DivRem(int1, int2, out intRemainder); --- or --- int intRemainder = int1 % int2; The 2nd way is what Joseph was talking about. The first way is longer however it is using .NET routines so it is safer if you care about cross coding. I would normally always use the second method.

            R 1 Reply Last reply
            0
            • D Daniel M Edwards

              int intRemainder = 0; Math.DivRem(int1, int2, out intRemainder); --- or --- int intRemainder = int1 % int2; The 2nd way is what Joseph was talking about. The first way is longer however it is using .NET routines so it is safer if you care about cross coding. I would normally always use the second method.

              R Offline
              R Offline
              R Thomas 0
              wrote on last edited by
              #6

              tks...i was looking for a Math fn....:) Have a Super Blessed Day! ------------------------- For God has not given us a spirit of fear, but of power and of love and of a sound mind. 2 Timothy 1:7 "For God so loved the world that He gave His only begotten Son, that whoever believes in Him should not perish but have everlasting life." John 3:16 "Therefore you also be ready, for the Son of Man is coming at an hour you do not expet." Luke 12:40

              D 1 Reply Last reply
              0
              • R R Thomas 0

                tks...i was looking for a Math fn....:) Have a Super Blessed Day! ------------------------- For God has not given us a spirit of fear, but of power and of love and of a sound mind. 2 Timothy 1:7 "For God so loved the world that He gave His only begotten Son, that whoever believes in Him should not perish but have everlasting life." John 3:16 "Therefore you also be ready, for the Son of Man is coming at an hour you do not expet." Luke 12:40

                D Offline
                D Offline
                Daniel M Edwards
                wrote on last edited by
                #7

                =)

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups