+ Start a Discussion
Pankaj Srivastava 9Pankaj Srivastava 9 

I want to use math.ceil function if we input 12.50 the output will be 13.00 or if we input 12.49 the output will be 12.00 please help me out

Best Answer chosen by Pankaj Srivastava 9
Deepak_KumarDeepak_Kumar
Hi Pankaj,
You can use the following :
Decimal num1 = 12.4;
System.debug(num1.round(System.RoundingMode.HALF_UP)) ; // Output :  12
Decimal num2 = 12.5;
System.debug(num2.round(System.RoundingMode.HALF_UP)) ; // Output :  13
Decimal num3 = 12.6;
System.debug(num3.round(System.RoundingMode.HALF_UP)) ; // Output :  13

I hope this solves your issue. If yes, please mark this as the best answer.

Regards
Deepak