working days in a month textbox1 calendarimage
pay days textbox2
ScaleAmt Total Amt
otamount textbox3 textbox4
I WRITE THE CODE IN TEXTBOX2_TEXTCHANGED I WRITE THE BELOW CODE
double working days in a month = Convert.ToDouble(textbox1.Text);
double pay days = Convert.ToDouble(textbox2.Text);
double a = Convert.ToDouble(textbox3 .Text);
textbox4.Text = Convert.ToDouble((a /working days in a month ) * pay days).ToString();
in run mode
in textbox1 i choose january month 31 days will appear in the textbox1
in textbox2 i type 25
in textbox3 type 2720
in textbox4 2193.54838709677(ANSWER)
but my question is answer 2193.54838709677 is correct but i want the answer roundoff that is 2194.
from the above code for roundoff how to write the code.from the above please make changes and send the new code for me it is great helpful for me also.
Regards,
RAO
Loading
Satyapriya NayakPosted Dec 5, 2012, 7:26 AM
Satyapriya NayakPosted Jul 11, 2012, 11:25 PM
I think your problem had solved ,if so then why you are not accepting the answer.
Thanks
VulpesPosted Jul 11, 2012, 12:56 PM
double working_days_in_a_month = Convert.ToDouble(textbox1.Text);
double pay_days = Convert.ToDouble(textbox2.Text);
double a = Convert.ToDouble(textbox3.Text);
textbox4.Text = Math.Round(a / working_days_in_a_month * pay_days).ToString();
Note that identifiers in C# can't contains spaces. I've replaced them with underscores in the above code.
Note also that you don't need to convert the following expression to a double - it's a double already:
a / working_days_in_a_month * pay_days