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. How to round the result up to the integer?

How to round the result up to the integer?

Scheduled Pinned Locked Moved C#
questioncsharptutorial
3 Posts 3 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
    Ravi Munde
    wrote on last edited by
    #1

    X is a float and I need to perform x/10 and round the result up to the integer. So if result is 0.4 -> 1, if 1.1 -> 2, 2.7 -> 3. How can I do this in C#?

    S V 2 Replies Last reply
    0
    • R Ravi Munde

      X is a float and I need to perform x/10 and round the result up to the integer. So if result is 0.4 -> 1, if 1.1 -> 2, 2.7 -> 3. How can I do this in C#?

      S Offline
      S Offline
      S a n d y
      wrote on last edited by
      #2

      You can see this thread. This is the solution of your problem. http://msdn.microsoft.com/en-us/library/zx4t0t48.aspx[^]

      1 Reply Last reply
      0
      • R Ravi Munde

        X is a float and I need to perform x/10 and round the result up to the integer. So if result is 0.4 -> 1, if 1.1 -> 2, 2.7 -> 3. How can I do this in C#?

        V Offline
        V Offline
        Vikram A Punathambekar
        wrote on last edited by
        #3

        Math.Ceiling()

        Cheers, Vıkram.


        I've never ever worked anywhere where there has not been someone who given the choice I would not work with again. It's a job, you do your work, put up with the people you don't like, accept there are probably people there that don't like you a lot, and look forward to the weekends.   - Josh Gray.

        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