Click here to Skip to main content
15,867,750 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how could I check the quantity value is decimal or not

For Example:

Qty may be 0.5 or 1.0 or 1.5

if Qty is 0.5 or 1.5,

I want to plus 0.5 to get integer value as
Qty is 1.0 or 2.
Posted
Comments
Sergey Alexandrovich Kryukov 25-Dec-12 16:01pm    
Why? This is a wrong approach to programming in strongly-typed languages.
—SA

There are any number of ways to do this. For example:

C#
double d = 5.0;
bool isInt = d == (int)d;
You can also use modulo.

C#
double d = 5.0;
bool isInt = d % 1 == 0;
 
Share this answer
 
Hi,

you can use Math functions.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900