Click here to Skip to main content
15,923,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Suppose i have value like 1.3333. how can i get value like 1.4 in C# ?
Please give suggestions.
Posted
Comments
Maciej Los 7-Apr-15 2:28am    
Based on what condition?
King Fisher 7-Apr-15 3:04am    
your health Condition ;) lol
Maciej Los 7-Apr-15 3:23am    
;)

Try:
C#
private static double RoundUpToOneDecimalPlace(double p)
    {
    return Math.Ceiling(p * 10) / 10;
    }
 
Share this answer
 
Comments
SRINIVASA RAO T 7-Apr-15 6:00am    
Good Answer.Thank "U" Very Much.
OriginalGriff 7-Apr-15 6:19am    
You're welcome!
Refer these function hope will helpful,

Math.Floor() //rounds down
Math.Ceiling() //rounds up,
Math.Truncate() // rounds towards zero
 
Share this answer
 

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