# How to Ceiling a number using Express Language in JSTL

In my JSTL code I wrote like,

<fmt:formatNumber value="${2.6}" type="number" pattern="#"/> returns 3 and the following <fmt:formatNumber value="${2.4}" type="number" pattern="#"/>

returns 2 and I need 3, a ceiling of a number.

Is there any way to do this?

Use the below snippet.

<fmt:formatNumber value="\${N+(1-(N%1))%1}" type="number" pattern="#"/>

(where N is the name of your variable.)

Its give you the floor rounding to get your exact output.