Visual Basic .net woes
I'm designing a small program to display the factors of the number.
Currently i'm using \ division and Mod to get the remainder.
chan1 = Result \ 20
If Result < 20 Then
chan1 = 0
End If
rema1 = Result Mod 20
The program takes a number (Result in this case) and divides it by a denomination (20 in this case) and stores the result in chan1.
If Result is less than the denomination then chan1 becomes 0.
It then Mod's Result over 20 to get the remainder and stores this in rema1.
In the next phase chan1 becomes chan2.
20 becomes 10 as that is the next denomination I am checking for.
And rema1 becomes rema1.
Later on I display the amount of denominations like this
Console.WriteLine((chan1) & " x 20")
And this goes down the list from 20 through till 0.01.
What I'm aiming for is a result like this
Result = 35
1 x 20
1 x 10
1 x 5
0 x 2
The problem i'm having is that even though i'm using \ i'm still getting decimal answers for chan4 which deals with Denom of 2.
e.g
Result = 38.88
1 x 20
1 x 10
1 x 5
2 x 2
2 x 1
1.76 x .50
In the case of Denom 2 and 1 it rounds it up which it shouldn't do.
In the case of .50 downwards it gives me decimal 'chans'.
I've tried a few things to fix this and I'm really stuck with the whole thing.
If you've got any suggestions or if I haven't explained myself please leave a post and I'll try and elaborate.
