Can someone suggest me a way to multiply decimal numbers without using the multiplication sign (*). I know this sounds like homework, but I just want to know how to achieve this. I have already done this for positive and negative integers, as shown below:
int first = 2;
int second =2;
int result = 0;
bool isNegative = false;
if (first < 0)
{
first = Math.Abs(first);
isNegative = true;
}
if (second < 0)
{
second = Math.Abs(second);
isNegative = true;
}
for (int i = 1; i <= second; i++)
{
result += first;
}
if (isNegative)
result = -Math.Abs(result);
Want to multiply this by decimal places:
decimal third = 1.1;
decimal fourth = 1.2;
thanks
source
share