Math Problem Statement

What will be the output of the following code?

1 numbers {1,2,3,4,5,5,6}

2 int num1 numbers.size() 1;

3 int num2 0;

4 for(each number){

5 add number to num2 and assign again to num2

6}

7 int num3 = num2 (num1* (num1+1)/2);

8 return num3;

Solution

Ask a new question for Free

By Image

Drop file here or Click Here to upload

Math Problem Analysis

Mathematical Concepts

Summation
Arithmetic Operations

Formulas

Sum of an arithmetic series

Theorems

-

Suitable Grade Level

Middle School