multiplication without using multiplication in java code example
Example: multiplication without using multiplication in java
public class SumOfElements {
public static void main(String[] args){
int[] a = {1,2,3,4,5};
int sum = sumArray(a);
int result = multiply(5,10);
}
private static int multiply(int i , int j) {
int k = 1;
int sum = 0;
while(k <= j)
{
sum = sum + i;
k++;
}