1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Round off number to next 10

Discussion in 'C#' started by eLucknow.com, Aug 20, 2008.

  1. #1
    it is easy to use round function in asp to round off decimal digit. but how can i round off number (ex 5862) to next 10 (as 5870) using asp.
    eLucknow.com, Aug 20, 2008 IP
  2. engager

    engager Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    When I see no pratical solution I do my own function.
    try this

    function RoundToNextTen(num)
    if (num / 10) = CLng(num / 10) then
    RoundToNextTen = num
    else
    RoundToNextTen = (CLng(num / 10) + 1) * 10
    end if
    end function
    engager, Aug 21, 2008 IP
  3. vihutuo

    vihutuo Well-Known Member Premium Member

    Messages:
    1,511
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    130
    #3
    The simplest way would be this

    Private Function RoundToTen(ByVal num)
    Return num - (num Mod 10) + 10
    End Function



    vihutuo, Aug 22, 2008 IP