Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Finding decimal value
Message
From
29/05/2011 11:36:33
 
 
To
29/05/2011 10:58:15
Vishal Nyamagoudar
Swift Infocom India Pvt Ltd
India
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 3.0
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01512198
Message ID:
01512206
Views:
48
>Hello Everyone,
>
>Code is in C#.net
>
>double a,b,ans;
>a=3;
>b=2;
>ans=a/b;
>
>ans will be 1.5 dcimal value
>
>i want to check returned answer is decimal value or integer value
>
>like if ans is 1.5 then decimal
>
> if ans is 2 then it should return integr value
>
>How cal i find out returned answer is integer or decimal value..!!!!
>
>Thanks...

The return type will, obviously, always be double. But maybe for what I think you are asking:
bool IsInt = ((int)ans) == ans;
but you should check that ans is not outside the integer range
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform