multiplication without using multiplication in java

Solutions on MaxInterview for multiplication without using multiplication in java by the best coders in the world

showing results for - "multiplication without using multiplication in java"
Aitana
16 May 2017
1public class SumOfElements {
2  
3  public static void main(String[] args){
4    
5    int[] a = {1,2,3,4,5};
6    
7    
8    int sum = sumArray(a);
9    
10   int result = multiply(5,10);
11  }
12  
13  private static int multiply(int i , int j) {
14    
15    int k = 1;
16    int sum = 0;
17    
18    while(k <= j)
19    {
20      sum = sum + i;
21      k++;
22    }
23    
24