Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Extended KotD #25, #26, and #27: INTEGER DIVISION, CINT, and CLNG
#2
Code: (Select All)

For i = 1 To 10
    x = i + .5
    Print x, CInt(x)
Next
gives
Code: (Select All)

1.5          2
2.5          2
3.5          4
4.5          4
5.5          6
6.5          6
7.5          8
8.5          8
9.5          10
10.5          10
it follows a simple rule
if integer-part is odd then round-up
if integer-part is even then round-down
Reply


Messages In This Thread
RE: Extended KotD #25, #26, and #27: INTEGER DIVISION, CINT, and CLNG - by Jack - 05-04-2025, 12:26 PM



Users browsing this thread: 12 Guest(s)