Write a c program to print the sum of 5 elements of an array.
Answers
Answered by
0
Answer:
Python
1. #Initialize array.
2. arr = [1, 2, 3, 4, 5];
3. sum = 0;
4. #Loop through the array to calculate sum of elements.
5. for i in range(0, len(arr)):
6. sum = sum + arr[i];
7. print("Sum of all the elements of an array: " + str(sum));
Explanation:
please mark my answer as brainliest
Similar questions
Economy,
1 month ago
Math,
1 month ago
Math,
4 months ago
Math,
10 months ago
Computer Science,
10 months ago