# can someone help me?

closed May 12

Situational Problem:

Camille has a grade in the following subject:

Araling Panlipunan (99)

Science (96)

English (90)

Filipino (91)

Math (94)

TLE (93)

What is the sum and average grade of Camille with the use of data in compiling an array?

closed with the note: answered

answered Apr 20 by (58,190 points)
You can calculate the sum by adding all of those numbers (so 99 + 96 + 90 + 91 + 94 + 93 = *you do the calcualtion*).

You can calculate the average by adding all the numbers (, that is, using the sum), then dividing it by the number of elements added (in your case, that's 6).

If you store things in an array, you need to iterate through the array and take the values from the array. Then the number of elements in the array is the length of the array.

Try to write some code and share it if you get stuck. Also, include what language are you after.
+1 vote
answered Apr 20 by (160 points)
a = [99,96,90,91,94,93]
b = len(a)
sum1 = 0
for i in a:
sum1 = sum1 + i
print("sum of the all subject is ",sum1)
average = sum1/b
print("average is ",average)
commented Apr 27 by (100 points)
I think in there is correction in 5th line as
sum1=Suma+a[i]
commented May 1 by (100 points)
i want to correct one thing also in this:-
sum1=sum1+a[i]
#you wrote suma(and it will give error)
+1 vote
answered Apr 25 by (1,330 points)
Add on the numbers together (563 in this case), then divide that by how many numbers you have (6 in this case) and you get 93.83.
+1 vote
answered Apr 27 by (160 points)
And here it is not required to process strings with "pulling out" numbers from brackets in order to add everything up and determine the average? Then the solution will not be so trivial.
answered May 12 by (180 points)

#include <iostream>

using namespace std;

int main(){

float sum=0;

for (int i=0; i<6; i++){