Use
 
return (int)(num >= 0 ? num+0.5 : num - 0.5);
 
Dave

On Monday, July 16, 2012 1:25:04 AM UTC-5, amit wrote:

> No It will not.
>
> For negative number, it will fail.
>
> On Sun, Jul 15, 2012 at 11:45 PM, Tanuj Makkar <
> tanujmakkar.de...@gmail.com> wrote:
>
>> double round(double num)
>> { return (int)(num+0.5)
>> }
>> will it work all the time?
>> ..........
>> didnt get it........can anyone explain it.....thnx in advance.....
>>
>> On Friday, 26 August 2011 21:58:05 UTC+5:30, rahul sharma wrote:
>>>
>>> hi guys...microsoft is coming to our campus..plz nyone tell their 
>>> recruitment procedure..n give me their previous xams question if nyone 
>>> has...........but please tell me their selection procedure n 
>>> rounds........cuming after 2 days.....plz reply soon.....n tell me the 
>>> subjects to crack microsoft.............nyon having info reply fast 
>>> plz......
>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Algorithm Geeks" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/algogeeks/-/mWeduVanassJ.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/MXlsDpzjxP4J.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to