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

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)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.