title: Integer to Roman Format
body: <p>I am trying to get the roman numbers from 0-50. I just write the integer number on the textbox and press the button and I want to have its roman format in the label.</p>
  
  <p>I have written the code and it works very well from 0-50 numbers. </p>
  
  <p>But, I think that the solution which I have is not optimal.</p>
  
  <p>Can anyone please help me, how can I make it more optimal.     </p>
  
  <pre><code>int number = Convert.ToInt32( tb_input.Text);
              StringBuilder sb = new StringBuilder();      
              sb= IntToRoman(number, sb);
  
  
  
         Label1.Text =sb.ToString();
  
  
  public StringBuilder IntToRoman(int number, StringBuilder sb)
      {
          int flag = 0;
          if (number &gt;= 50 &amp;&amp; flag==0)
          {
              sb.Append("L");
              IntToRoman(number - 50, sb);
              flag = 1;
          }
          if (number &gt;= 10 &amp;&amp; flag == 0)
          {
              sb.Append("X");
              IntToRoman(number - 10, sb);
              flag = 1;
  
          }
          if (number &gt;= 9 &amp;&amp; flag == 0)
          {
              sb.Append("IX");
              IntToRoman(number - 9, sb);
              flag = 1;
          }
  
          if (number &gt;= 5 &amp;&amp; flag == 0)
          {
              sb.Append("V");
              IntToRoman(number - 5, sb);
              flag = 1;
          }
          if (number &gt;= 4 &amp;&amp; flag == 0)
          {
              sb.Append("IV-");
              IntToRoman(number - 4, sb);
              flag = 1;
          }
  
          if (number &gt;= 1 &amp;&amp; flag == 0)
          {
              sb.Append("I");
              IntToRoman(number - 1, sb);
              flag = 1;
          }
  
          if (number ==0)
          {            
              return sb;
  
          }
          return sb;
      }
  </code></pre>