C#
homeModel.FinancialComplianceModelList.AnnualDebtService=20;
homeModel.FinancialComplianceModelList.AnnualLeaseExpense=50;
homeModel.FinancialComplianceModelList.PPR=100;
decimal DebtAndLeaseToPPRRatio = Convert.ToDecimal((homeModel.FinancialComplianceModelList.AnnualDebtService + homeModel.FinancialComplianceModelList.AnnualLeaseExpense) / homeModel.FinancialComplianceModelList.PPR);
I Calculated the values for like above formula . The calculated values is
0.35
I want a digit values. So i use math.round()
Int finalvalue=Convert.ToInt32( Math.Round(DebtAndLeaseToPPRRatio));
Now That FinalValue is 0
//It's good
Javascript
Now I used the same formula with same values in a javascript
for see this below code
$("#DebtAndLeaseToPPRRatio").text(Math.round(((AnnualDebtService + AnnualLeaseExpense) / PPR).toFixed(1)) + "%");
But Now it's display result is 1
.
When i used the same formula Why the c# is display 0
? and Javascript
is return 1
?