2. Write a program to sum of array values

public class Main {
    public static void main(String[] args) {
        int[] numbers={14,12,9,15,17,21,23,5,8,25};
        int sum=0;
        for(int i=0;i<numbers.length;i++){
            sum+=numbers[i];
        }
        System.out.println("Total sum is: "+sum);

    }
}
Output:
Total sum is: 149
about author

admin

salmansrabon@gmail.com

If you like my post or If you have any queries, do not hesitate to leave a comment.

Leave a Reply

Your email address will not be published. Required fields are marked *