| Round without using round command in visual basic?

Round without using round command in visual basic?

Dan asked:


I am in a very basic computer programming class. We are currently using visual basic 6.0. My teacher assigned homework to create a program that would round a number without using the actual round() command. He mentioned the Mod() command but would not divulge anymore information. Can someone suggest how this could be done? Thanks to all who respond!

Related posts:

  1. Which of these 2 classes should I drop “INTRO C++ PROGRAMMING” or “INTRO VISUAL BASIC”? ernerock asked: Im in college and I need to drop...
  2. I hate Java and I hate Visual Basic and programming in general. WHAT DO YOU THINK ABOUT THIS? Lynn D asked: I hate Java and I hate Visual...
  3. How to create a login form in visual basic which is linked to SQL server database? HELP? Zacken asked: I’m creating a database program in Visual basic...
  4. How to write a program in Visual Basic to add, update, or delete records? Kevin asked: Okay, I’m about stressed to the limits right...
  5. how would you call data from documents in visual basic? someone… asked: i am trying to call information from a...

Filed Under Programming & Design |

Tagged With , ,

Comments

One Response to “Round without using round command in visual basic?”

  1. Brent P on June 10th, 2009 9:43 pm

    There’s two parts to this…

    First there’s the \ operator, unlike the / operator, it will only return the whole integer of the result, for instance:

    myInt = 14 \ 10

    myInt will have a value of 1.

    The Mod operator on the other hand will return the remainder for the division, for example :

    myRemainder = 14 mod 10

    myRemainder will be 4.

    What you need to do is create a function that will return the remainder for a division by a number (perhaps the lonliest?) and increase the whole number if that remainder is greater than a certain value.

    Hopefully that’s enough for you to go on as any more detail would be to write it for you, which would defeat the point of the homework ;)