Using functions | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Using functions

How can I use function to calculate the total marks of a student

8th Dec 2019, 11:33 PM
Aidoo Collins
1 Answer
+ 1
This information is too thin, but if you have an array of marks, and a sum variable (which equals 0), you can use the enchanted for loop and add each mark to the sum variable. To apply this with a function you need to have an array parameter which represents the mark array and you also need to return the sum variable in the end of the function.
9th Dec 2019, 12:18 AM
Seb TheS
Seb TheS - avatar