 <p>Let me first warn you that long ternary operations like this is usually not prescribed as it's only going to cause problems in the future if there's any modifications. Nevertheless, the following will do the required:</p> <pre><code>int x = 600000; x = (x &gt; 250000 &amp;&amp; x &lt; 500000) ? ((x / 100) * 10): ((x &gt; 500000 &amp;&amp; x &lt; 1000000) ? ((x / 100) * 20): (x &gt; 1000000) ? ((x / 100) * 30):x); </code></pre>