How can I perform multiplication without the '*' operator?

前端 未结 30 1509
别跟我提以往
别跟我提以往 2020-12-01 01:47

I was just going through some basic stuff as I am learning C. I came upon a question to multiply a number by 7 without using the * operator. Basically it\'s like this

<
30条回答
  •  南方客
    南方客 (楼主)
    2020-12-01 02:42

    import java.math.BigInteger;
    
    public class MultiplyTest {
        public static void main(String[] args) {
            BigInteger bigInt1 = new BigInteger("5");
            BigInteger bigInt2 = new BigInteger("8");
            System.out.println(bigInt1.multiply(bigInt2));
        }
    }
    

提交回复
热议问题