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

前端 未结 30 1575
别跟我提以往
别跟我提以往 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

    public static void main(String[] args) {
        System.out.print("Enter value of A -> ");
        Scanner s=new Scanner(System.in);
        double j=s.nextInt();
        System.out.print("Enter value of B -> ");
        Scanner p=new Scanner(System.in);
        double k=p.nextInt();
        double m=(1/k);
        double l=(j/m);
        System.out.print("Multiplication of A & B=> "+l);
    }
    

提交回复
热议问题