I don't really understand what you are trying to achieve. are you trying to find a percentage of a given number or are you trying to multiply a number by a percentage of another number?
A percentage is based on the number 100 and is just some number divided by 100...just rummage through your input and isolate any numbers with a %, drop the % symbol, divide the number by 100 and finish the rest of the math.
Your example of 10*100% is confusing though...you can't multiply 10 by 100% because the 100% is out of context. 100% of what? 50? 20? 3.14? I'd recommend you first find a different input method because the string you gave as an example doesn't make much sense...I'm assuming you want to find 100% of 10...which is 10 of course but let's say you want 50% of 10 instead...
The real math is 10*0.5 = 5...so, just isolate the percentage (50%) drop the % sign and divide 50 by 100 = 0.5 and then move on with the math 10*0.5.
Sorry if that doesn't make sense, but the example is a bit confusing to me.
Is this a console program or winforms? If it's a console it might be more difficult because you need to work with a string instead of having a input box. But I could be wrong...I don't like console programs...never made one.
Another consideration is multiple operators...what would your program do if given this: 10*100%*50? Just something to ponder...
(Please Check this code and find out what i am doing wrong)
// (Result Card)
private void btnsum_Click(object sender, EventArgs e)
decimal mh = Convert.ToDecimal(txtMath.Text);
decimal en = Convert.ToDecimal (txtEnglish.Text);
decimal ur= Convert.ToDecimal(txtUrdu.Text);
decimal t = mh + en + ur;
lbltotal.Text = t.ToString();
// Declare percentage
* when i want show percentage in label called lblpercentshow
* it give error ( c# codeError 1 Cannot implicitly convert type 'decimal' to 'string)
please send me code of percentage
* how can i get percentage in label1
lblpercentshow.Text = t / 30 * 100;
am creating the two textboxes in c# enter the username&password that two textboxes to retrive the data through sql & check it correct/wrong
once correct open the windows form
wrong not open windows
please send me code
For Each ctrl As Control In Me.Controls("pnlMainPanel").Controls
If ctrl.GetType Is GetType(System.Windows.Forms.Panel) Then
For Each subCtrl As Control In ctrl.Controls
If subCtrl.GetType Is GetType(System.Windows.Forms.TextBox) Then
If subCtrl.GetType Is ...