TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
How to Find Denomination Value
Kml Surani
May 31
2015
Code
2.8
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
Denominator.rar
Step 1:
Create A Design
<script type=
"text/javascript"
>
function NumericDataOnlyWithoutPeriod(e) {
if
((e.which > 47 && e.which < 59) || (e.which == 8) || (e.which == 16) || (e.which == 9) || (e.which == 0) || (e.which == 13))
return
;
else
e.preventDefault();
}
</script>
<asp:TextBox ID=
"txtNumber"
runat=
"server"
onkeypress=
"return NumericDataOnlyWithoutPeriod(event);"
></asp:TextBox>
<asp:Button ID=
"btnClick"
runat=
"server"
Text=
"Click"
OnClick=
"btnClick_Click"
/>
<br />
<br />
<br />
<asp:Label ID=
"lblValue"
runat=
"server"
Text=
""
></asp:Label>
<br />
<br />
Step 2:
Logic Denomination
protected
void
btnClick_Click(object sender, EventArgs e)
{
int
[] no = { 1000, 500, 100, 50, 20, 10, 5, 2, 1 };
int
inttxtNo = Convert.ToInt32(txtNumber.Text);
int
j = 0;
int
k = 0;
string strValue =
""
;
for
(
int
i = 0; i < no.Length; i++)
{
j = inttxtNo / no[i];
k = j * no[i];
inttxtNo = inttxtNo % no[i];
if
(k != 0)
{
strValue = strValue +
"<br>"
+ j +
"*"
+ no[i] +
"="
+ k;
}
}
lblValue.Text = strValue;
}
.net
Denomination