How to Find Denomination Value

Step 1: Create A Design
  1. <script type="text/javascript">  
  2.     function NumericDataOnlyWithoutPeriod(e) {  
  3.         if ((e.which > 47 && e.which < 59) || (e.which == 8) || (e.which == 16) || (e.which == 9) || (e.which == 0) || (e.which == 13)) return;  
  4.         else e.preventDefault();  
  5.     }  
  6. </script>   
  1. <asp:TextBox ID="txtNumber" runat="server" onkeypress="return NumericDataOnlyWithoutPeriod(event);"></asp:TextBox>        
  2. <asp:Button ID="btnClick" runat="server" Text="Click" OnClick="btnClick_Click" />  
  3. <br />  
  4. <br />  
  5. <br />  
  6. <asp:Label ID="lblValue" runat="server" Text=""></asp:Label>  
  7. <br />  
  8. <br />  
 Step 2: Logic Denomination
  1. protected void btnClick_Click(object sender, EventArgs e)  
  2.       {  
  3.   
  4.           int[] no = { 1000, 500, 100, 50, 20, 10, 5, 2, 1 };  
  5.           int inttxtNo = Convert.ToInt32(txtNumber.Text);  
  6.           int j = 0;  
  7.           int k = 0;  
  8.           string strValue = "";  
  9.           for (int i = 0; i < no.Length; i++)  
  10.           {  
  11.               j = inttxtNo / no[i];  
  12.               k = j * no[i];  
  13.               inttxtNo = inttxtNo % no[i];  
  14.               if (k != 0)  
  15.               {  
  16.                   strValue = strValue + "<br>" + j + "*" + no[i] + "=" + k;  
  17.               }  
  18.           }  
  19.           lblValue.Text = strValue;  
  20.       }