C++ Programming Code Examples C++ > Arrays and Matrices Code Examples C++ Program to Find Sum of an Array Elements C++ Program to Find Sum of an Array Elements Sum of all Array elements means add all array Elements. Suppose we have 4 Elements in array and we want to find there sum. arr[0]=4 arr[1]=2 arr[2]=1 arr[3]=6 Sum off all above elements are arr[0]+arr[1]+arr[2]+arr[3]=4+2+1+6=13 #include<iostream.h> #include<conio.h> void main() { int arr[20],j,n,sum=0; clrscr(); cout<<"How many elements you want to enter: "; cin>>n; cout<<"Enter any "<<n<<" elements in Array: "; for(j=0;j<n;j++) { cin>>arr[j]; } cout<<"Sum of all Elements are: "; for(j=0;j<n;j++) { sum=sum+arr[j]; } for(j=0;j<n;j++) { } cout<<sum; getch(); }