
i having problem
how to make algorithm for
[a][5] [a][10] [b][15] [b][10] [c][5] [c][5] . . . .
sum of [a] = 15 [b] = 25 [c] = 10 . . . .

Java Sum of array values
class SumOfArrayValues
{
public static void main(String[] args)
{
int sum=0;
int a[]={5,10};
for(int i=0;i<a.length;i++){
sum+=a[i];
}
System.out.println("Sum: "+sum);
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.