Use if else conditions with shortcuts
<p>Below is my codes: </p>

<p>Code 1:</p>

<pre><code>int x = 10;

if (x &lt; 10)
{
    if (x &lt; 5)
    {
        MessageBox.Show("less than 5");
    }
    else
    {
        MessageBox.Show("value is between 5 and 10");
    }
}
else
{
    MessageBox.Show("grater than 10");
}
</code></pre>

<p>Code 2:</p>

<pre><code>int x = 10;

if (x &gt; 5 &amp;&amp; x &lt; 10)
{
    MessageBox.Show("Value is between 5 and 10");
}
else if (x &lt; 5)
{
    MessageBox.Show("less than 5");
}                
else
{
    MessageBox.Show("grater than 10");
}
</code></pre>

<p>How can I write this code using inline if conditions.</p>
