Hello StackOverFlow colleagues, I am currently trying to multiply percentages%, but currently I have not been able to perform this operation,
Considering that it is a foreach
that loads both inputs
.weight and .qualification the times that there is a record I need to do the following operation:
Rating * Weight + Rating * Weight + rating * weight and so on depending on the number of records thrown by the cycle foreach
.
An example of data would be the following since I am working with percentages and decimals
I enclose image for greater understanding
My code is as follows
@foreach (var item in ViewBag.listobjetivos)
{
<tr>
<td>@item.Nombre_Objetivo</td>
<td><input class="peso" type="text" value="@item.Peso_Objetivo" />%</td>
<td>@item.Descripcion_Objetivo</td>
<td><input class="calificacion" type="text" value='@string.Format("{0:F1}", item.calificacion)' /></td>
<td>@item.observacion</td>
</tr>
}
<span class="resultado"></span>
I need to multiply the weight that is a percentage% by rating and the same for the other records but I need a total result of the sum of all
Here I leave an image in excel so you can understand me a little better, in the image you see the operation in excel.
Example Rating: 1.5 * Weight: 5%, Result: 0.075
I remain attentive to any doubt or novelty.