0

I want any amount ending in 98 cents.

Three examples:
5 euros x 1.25 euros then the result is 6.25 euros, the program change this to 6.95
4 euros + 2 euros then the result is 6.00 euros, the program change this to 6.95
User type to 6.70then the program change this to 6.95

How can I solve it very easily?

Thanks,

andre

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Mitja Bonca
0

Use this pattern to all:

Dim a As Decimal = 6.25D
//pattern:
Dim fraction As Decimal = a - CInt(Math.Truncate(a))
a = a - fraction + (0.95D)

Edited by Mitja Bonca: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.