How to multiply two numbers without using the multiple operator (*) in C#

1 Answer

0 votes
using System;

public class MultiplyTwoBumbersWithoutMultipleOperator_CSharp
{
    public static void Main()
    {
       int a = 3, b = 9, mul = 0;
 
        // mul = a * b
 
        for (int i = 1; i <= a; i++) {
            mul = mul + b;
        }
 
        Console.WriteLine("{0} * {1} = {2}", a, b, mul);
    }
}



/*
run:

3 * 9 = 27

*/


answered Apr 8, 2014 by avibootz
edited Dec 5, 2024 by avibootz
...