Q. Program to print the sum of all the elements of an array.ExplanationIn this program, we need to calculate the sum of all the elements of an array. This can be solved by looping through the array and add the value of the element in each iteration to variable sum. Sum of all elements of an array is 1 + 2 + 3 + 4 + 5 = 15. Algorithm
SolutionPythonOutput: Sum of all the elements of an array: 15 COutput: Sum of all the elements of an array: 15 JAVAOutput: Sum of all the elements of an array: 15 C#Output: Sum of all the elements of an array: 15 PHPOutput: Sum of all the elements of an array: 15 Next Topic# |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India