Friday, September 30, 2011

Rounded off total income

//Rounded off total income

Int32 roundedAmt;
Int32 torounded = Convert.ToInt32(lblTotalIncome.Text);
int lastdigit = torounded % 10;
if (lastdigit >= 5)
{
roundedAmt = torounded - lastdigit + 10;
}
else
{
roundedAmt = torounded - lastdigit;
}
lblRoundedOf.Text = Convert.ToString(roundedAmt);

Thanks & Regards